bump patchlevel; other minor fixes for clean build and test on
[p5sagit/p5-mst-13.2.git] / win32 / perlhost.h
index 10abef9..2190809 100644 (file)
@@ -402,54 +402,7 @@ public:
     };
     virtual int Rename(const char *OldFileName, const char *newname, int &err)
     {
-       char szNewWorkName[MAX_PATH+1];
-       WIN32_FIND_DATA fdOldFile, fdNewFile;
-       HANDLE handle;
-       char *ptr;
-
-       if((strchr(OldFileName, '\\') || strchr(OldFileName, '/'))
-               && strchr(newname, '\\') == NULL
-                       && strchr(newname, '/') == NULL)
-       {
-           strcpy(szNewWorkName, OldFileName);
-           if((ptr = strrchr(szNewWorkName, '\\')) == NULL)
-               ptr = strrchr(szNewWorkName, '/');
-           strcpy(++ptr, newname);
-       }
-       else
-           strcpy(szNewWorkName, newname);
-
-       if(stricmp(OldFileName, szNewWorkName) != 0)
-       {   // check that we're not being fooled by relative paths
-           // and only delete the new file
-           //  1) if it exists
-           //  2) it is not the same file as the old file
-           //  3) old file exist
-           // GetFullPathName does not return the long file name on some systems
-           handle = FindFirstFile(OldFileName, &fdOldFile);
-           if(handle != INVALID_HANDLE_VALUE)
-           {
-               FindClose(handle);
-        
-               handle = FindFirstFile(szNewWorkName, &fdNewFile);
-        
-               if(handle != INVALID_HANDLE_VALUE)
-                   FindClose(handle);
-               else
-                   fdNewFile.cFileName[0] = '\0';
-
-               if(strcmp(fdOldFile.cAlternateFileName, fdNewFile.cAlternateFileName) != 0
-                       && strcmp(fdOldFile.cFileName, fdNewFile.cFileName) != 0)
-               {   // file exists and not same file
-                   DeleteFile(szNewWorkName);
-               }
-           }
-       }
-       int ret = rename(OldFileName, szNewWorkName);
-       if(ret)
-           err = errno;
-
-       return ret;
+       CALLFUNCRET(win32_rename(OldFileName, newname))
     };
     virtual int Setmode(int handle, int mode, int &err)
     {
@@ -515,6 +468,10 @@ public:
     {
        win32_abort();
     };
+    virtual char * Crypt(const char* clear, const char* salt)
+    {
+       return win32_crypt(clear, salt);
+    };
     virtual void Exit(int status)
     {
        exit(status);
@@ -699,23 +656,39 @@ public:
     };
     virtual char* GetBase(PerlIO* pf, int &err)
     {
+#ifdef FILE_base
        FILE *f = (FILE*)pf;
        return FILE_base(f);
+#else
+       return Nullch;
+#endif
     };
     virtual int GetBufsiz(PerlIO* pf, int &err)
     {
+#ifdef FILE_bufsiz
        FILE *f = (FILE*)pf;
        return FILE_bufsiz(f);
+#else
+       return (-1);
+#endif
     };
     virtual int GetCnt(PerlIO* pf, int &err)
     {
+#ifdef USE_STDIO_PTR
        FILE *f = (FILE*)pf;
        return FILE_cnt(f);
+#else
+       return (-1);
+#endif
     };
     virtual char* GetPtr(PerlIO* pf, int &err)
     {
+#ifdef USE_STDIO_PTR
        FILE *f = (FILE*)pf;
        return FILE_ptr(f);
+#else
+       return Nullch;
+#endif
     };
     virtual char* Gets(PerlIO* pf, char* s, int n, int& err)
     {
@@ -785,14 +758,18 @@ public:
     };
     virtual void SetCnt(PerlIO* pf, int n, int &err)
     {
+#ifdef STDIO_CNT_LVALUE
        FILE *f = (FILE*)pf;
        FILE_cnt(f) = n;
+#endif
     };
     virtual void SetPtrCnt(PerlIO* pf, char * ptr, int n, int& err)
     {
+#ifdef STDIO_PTR_LVALUE
        FILE *f = (FILE*)pf;
        FILE_ptr(f) = ptr;
        FILE_cnt(f) = n;
+#endif
     };
     virtual void Setlinebuf(PerlIO* pf, int &err)
     {
@@ -884,13 +861,13 @@ public:
            {
                try
                {
-                   pPerl->perl_construct();
+                   perl_construct();
                }
                catch(...)
                {
                    win32_fprintf(stderr, "%s\n",
                                  "Error: Unable to construct data structures");
-                   pPerl->perl_free();
+                   perl_free();
                    pPerl = NULL;
                }
            }
@@ -907,7 +884,7 @@ public:
        int retVal;
        try
        {
-           retVal = pPerl->perl_parse(xs_init, argc, argv, env);
+           retVal = perl_parse(xs_init, argc, argv, env);
        }
        catch(int x)
        {
@@ -927,7 +904,7 @@ public:
        int retVal;
        try
        {
-           retVal = pPerl->perl_run();
+           retVal = perl_run();
        }
        catch(int x)
        {
@@ -945,8 +922,8 @@ public:
     {
        try
        {
-           pPerl->perl_destruct();
-           pPerl->perl_free();
+           perl_destruct();
+           perl_free();
        }
        catch(...)
        {