#define WIN32_LEAN_AND_MEAN
#define WIN32IO_IS_STDIO
#include <tchar.h>
+#ifdef __GNUC__
+#define Win32_Winsock
+#endif
#include <windows.h>
/* #include "config.h" */
#include "XSUB.h"
#include <fcntl.h>
#include <sys/stat.h>
+#ifndef __GNUC__
+/* assert.h conflicts with #define of assert in perl.h */
#include <assert.h>
+#endif
#include <string.h>
#include <stdarg.h>
#include <float.h>
+#ifdef __GNUC__
+/* Mingw32 defaults to globing command line
+ * So we turn it off like this:
+ */
+int _CRT_glob = 0;
+#endif
+
#define EXECF_EXEC 1
#define EXECF_SPAWN 2
#define EXECF_SPAWN_NOWAIT 3
}
char *
-win32PerlLibPath(void)
+win32PerlLibPath(char *sfx,...)
{
+ va_list ap;
char *end;
+ va_start(ap,sfx);
GetModuleFileName((PerlDllHandle == INVALID_HANDLE_VALUE)
? GetModuleHandle(NULL)
: PerlDllHandle,
szPerlLibRoot,
sizeof(szPerlLibRoot));
-
*(end = strrchr(szPerlLibRoot, '\\')) = '\0';
if (stricmp(end-4,"\\bin") == 0)
end -= 4;
strcpy(end,"\\lib");
+ while (sfx)
+ {
+ strcat(end,"\\");
+ strcat(end,sfx);
+ sfx = va_arg(ap,char *);
+ }
+ va_end(ap);
return (szPerlLibRoot);
}
-char *
-win32SiteLibPath(void)
-{
- static char szPerlSiteLib[MAX_PATH+1];
- strcpy(szPerlSiteLib, win32PerlLibPath());
- strcat(szPerlSiteLib, "\\site");
- return (szPerlSiteLib);
-}
BOOL
HasRedirection(char *ptr)
}
int
-setuid(uid_t uid)
+setuid(uid_t auid)
{
- return (uid == ROOT_UID ? 0 : -1);
+ return (auid == ROOT_UID ? 0 : -1);
}
int
-setgid(gid_t gid)
+setgid(gid_t agid)
{
- return (gid == ROOT_GID ? 0 : -1);
+ return (agid == ROOT_GID ? 0 : -1);
}
/*
* we have to roll our own.
*/
+#ifdef USE_THREADS
+#ifdef USE_DECLSPEC_THREAD
__declspec(thread) char strerror_buffer[512];
+#else
+#define strerror_buffer (thr->i.Wstrerror_buffer)
+#endif
+#else
+char strerror_buffer[512];
+#endif
DllExport char *
win32_strerror(int e)
DWORD source = 0;
if(e < 0 || e > sys_nerr) {
+ dTHR;
if(e < 0)
e = GetLastError();
}
DllExport int
-win32_fstat(int fd,struct stat *bufptr)
+win32_fstat(int fd,struct stat *sbufptr)
{
- return fstat(fd,bufptr);
+ return fstat(fd,sbufptr);
}
DllExport int
* want to be at the vendor's whim on the default, we set
* it explicitly here.
*/
-#if !defined(_ALPHA_)
+#if !defined(_ALPHA_) && !defined(__GNUC__)
_control87(MCW_EM, MCW_EM);
#endif
+ MALLOC_INIT;
}
#ifdef USE_BINMODE_SCRIPTS
+
+