From: Nick Ing-Simmons Date: Tue, 21 Nov 2000 20:36:22 +0000 (+0000) Subject: Win32 builds and runs (mostly) with USE_PERLIO. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=83b075c35b61a28ca7e2629bb5d6e26f9e0354fe;p=p5sagit%2Fp5-mst-13.2.git Win32 builds and runs (mostly) with USE_PERLIO. PERLIO=perlio passes all tests. PERLIO=stdio (sadly the default) hangs in t.pragma/warnings.t #319 p4raw-id: //depot/perlio@7796 --- diff --git a/perlio.c b/perlio.c index c55b681..865e60e 100644 --- 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 diff --git a/win32/perllib.c b/win32/perllib.c index e2b245d..48843f9 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -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) diff --git a/win32/win32.c b/win32/win32.c index f28efa2..ed12430 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -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 */