Win32 builds and runs (mostly) with USE_PERLIO.
authorNick Ing-Simmons <nik@tiuk.ti.com>
Tue, 21 Nov 2000 20:36:22 +0000 (20:36 +0000)
committerNick Ing-Simmons <nik@tiuk.ti.com>
Tue, 21 Nov 2000 20:36:22 +0000 (20:36 +0000)
PERLIO=perlio passes all tests.
PERLIO=stdio (sadly the default) hangs in t.pragma/warnings.t #319

p4raw-id: //depot/perlio@7796

perlio.c
win32/perllib.c
win32/win32.c

index c55b681..865e60e 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -943,6 +943,11 @@ PerlIOUnix_oflags(const char *mode)
      oflags |= O_WRONLY;
     break;
   }
+ if (*mode == 'b')
+  {
+   oflags |= O_BINARY;
+   mode++; 
+  }   
  if (*mode || oflags == -1)
   {
    errno = EINVAL;
@@ -2399,8 +2404,18 @@ PerlIO_stdoutf(const char *fmt,...)
 PerlIO *
 PerlIO_tmpfile(void)
 {
- dTHX;
  /* I have no idea how portable mkstemp() is ... */
+#if defined(WIN32) || !defined(HAVE_MKSTEMP)
+ PerlIO *f = NULL;
+ FILE *stdio = tmpfile();
+ if (stdio)
+  {
+   PerlIOStdio *s = PerlIOSelf(PerlIO_push(f = PerlIO_allocate(),&PerlIO_stdio,"w+"),PerlIOStdio);
+   s->stdio  = stdio;
+  }
+ return f;
+#else
+ dTHX;
  SV *sv = newSVpv("/tmp/PerlIO_XXXXXX",0);
  int fd = mkstemp(SvPVX(sv));
  PerlIO *f = NULL;
@@ -2415,6 +2430,7 @@ PerlIO_tmpfile(void)
    SvREFCNT_dec(sv);
   }
  return f;
+#endif
 }
 
 #undef HAS_FSETPOS
index e2b245d..48843f9 100644 (file)
@@ -371,6 +371,7 @@ DllMain(HANDLE hModule,             /* DLL module handle */
         * process termination or call to FreeLibrary.
         */
     case DLL_PROCESS_DETACH:
+        PerlIO_cleanup();     
        EndSockets();
 #if defined(USE_THREADS) || defined(USE_ITHREADS)
        if (PL_curinterp)
index f28efa2..ed12430 100644 (file)
@@ -2443,11 +2443,7 @@ win32_popen(const char *command, const char *mode)
     }
 
     /* we have an fd, return a file stream */
-#ifdef USE_PERLIO
     return (PerlIO_fdopen(p[parent], (char *)mode));
-#else
-    return (fdopen(p[parent], (char *)mode));
-#endif
 
 cleanup:
     /* we don't need to check for errors here */