if (GenerateConsoleCtrlEvent(CTRL_C_EVENT,pid))
return 0;
break;
+ case SIGBREAK:
+ case SIGTERM:
+ if (GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT,pid))
+ return 0;
+ break;
default: /* For now be backwards compatible with perl5.6 */
case 9:
if (TerminateProcess(hProcess, sig)) {
if (GenerateConsoleCtrlEvent(CTRL_C_EVENT,pid))
retval = 0;
break;
+ case SIGBREAK:
+ case SIGTERM:
+ if (GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT,pid))
+ retval = 0;
+ break;
default: /* For now be backwards compatible with perl5.6 */
case 9:
if (TerminateProcess(hProcess, sig))
/* FindFirstFile() and stat() are buggy with a trailing
* backslash, so change it to a forward slash :-( */
case '\\':
+ if (l >= sizeof(buffer)) {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
strncpy(buffer, path, l-1);
buffer[l - 1] = '/';
buffer[l] = '\0';
win32_ftell(FILE *pf)
{
#if defined(WIN64) || defined(USE_LARGE_FILES)
+#if defined(__BORLAND__) /* buk */
+ return win32_tell( fileno( pf ) );
+#else
fpos_t pos;
if (fgetpos(pf, &pos))
return -1;
return (Off_t)pos;
+#endif
#else
return ftell(pf);
#endif
win32_fseek(FILE *pf, Off_t offset,int origin)
{
#if defined(WIN64) || defined(USE_LARGE_FILES)
+#if defined(__BORLANDC__) /* buk */
+ return win32_lseek(
+ fileno(pf),
+ offset,
+ origin
+ );
+#else
fpos_t pos;
switch (origin) {
case SEEK_CUR:
return -1;
}
return fsetpos(pf, &offset);
+#endif
#else
return fseek(pf, offset, origin);
#endif
DllExport int
win32_fgetpos(FILE *pf,fpos_t *p)
{
+#if defined(__BORLANDC__) && defined(USE_LARGE_FILES) /* buk */
+ if( win32_tell(fileno(pf)) == -1L ) {
+ errno = EBADF;
+ return -1;
+ }
+ return 0;
+#else
return fgetpos(pf, p);
+#endif
}
DllExport int
win32_fsetpos(FILE *pf,const fpos_t *p)
{
+#if defined(__BORLANDC__) && defined(USE_LARGE_FILES) /* buk */
+ return win32_lseek(fileno(pf), *p, SEEK_CUR);
+#else
return fsetpos(pf, p);
+#endif
}
DllExport void
do {
count = extend >= sizeof(b) ? sizeof(b) : (size_t)extend;
count = win32_write(fd, b, count);
- if (count < 0) {
+ if ((int)count < 0) {
retval = -1;
break;
}
win32_lseek(int fd, Off_t offset, int origin)
{
#if defined(WIN64) || defined(USE_LARGE_FILES)
+#if defined(__BORLANDC__) /* buk */
+ LARGE_INTEGER pos;
+ pos.QuadPart = offset;
+ pos.LowPart = SetFilePointer(
+ (HANDLE)_get_osfhandle(fd),
+ pos.LowPart,
+ &pos.HighPart,
+ origin
+ );
+ if (pos.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
+ pos.QuadPart = -1;
+ }
+
+ return pos.QuadPart;
+#else
return _lseeki64(fd, offset, origin);
+#endif
#else
return lseek(fd, offset, origin);
#endif
win32_tell(int fd)
{
#if defined(WIN64) || defined(USE_LARGE_FILES)
+#if defined(__BORLANDC__) /* buk */
+ LARGE_INTEGER pos;
+ pos.QuadPart = 0;
+ pos.LowPart = SetFilePointer(
+ (HANDLE)_get_osfhandle(fd),
+ pos.LowPart,
+ &pos.HighPart,
+ FILE_CURRENT
+ );
+ if (pos.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
+ pos.QuadPart = -1;
+ }
+
+ return pos.QuadPart;
+ /* return tell(fd); */
+#else
return _telli64(fd);
+#endif
#else
return tell(fd);
#endif
XSRETURN_EMPTY;
}
}
+ if (GIMME_V == G_SCALAR) {
+ XSRETURN_IV(osverw.dwPlatformId);
+ }
W2AHELPER(osverw.szCSDVersion, szCSDVersion, sizeof(szCSDVersion));
XPUSHs(newSVpvn(szCSDVersion, strlen(szCSDVersion)));
osver.dwMajorVersion = osverw.dwMajorVersion;
XSRETURN_EMPTY;
}
}
+ if (GIMME_V == G_SCALAR) {
+ XSRETURN_IV(osver.dwPlatformId);
+ }
XPUSHs(newSVpvn(osver.szCSDVersion, strlen(osver.szCSDVersion)));
}
XPUSHs(newSViv(osver.dwMajorVersion));