summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2000-11-21 20:36:22 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2000-11-21 20:36:22 +0000
commit83b075c35b61a28ca7e2629bb5d6e26f9e0354fe (patch)
tree05e231eb3d046f117c6207869d2e05bcf920c63d /perlio.c
parentefeab7a8047d7136a0235c1cc7329f57d6a8bfdd (diff)
downloadperl-83b075c35b61a28ca7e2629bb5d6e26f9e0354fe.tar.gz
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
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/perlio.c b/perlio.c
index c55b6810aa..865e60e6a5 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