summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2000-11-22 20:51:42 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2000-11-22 20:51:42 +0000
commit3789aae2a16ba33c51e31b2ff3418eaef6c2ff4d (patch)
tree9a12e3cda0e3055b8d5fbe9e0ad1e1ec9c904e14 /perlio.c
parent778e6c4e916dc84b9dcf48eba0d7d07e9d98e21b (diff)
downloadperl-3789aae2a16ba33c51e31b2ff3418eaef6c2ff4d.tar.gz
Win32 PerlIO intermediate state now working as expected.
- In current state we are still using C runtime in text/binary mode and "crlf" layer is just a dummy (clone of perlio buffer layer). - PERLIO=stdio and PERLIO=unix pass all expected tests. - PERLIO=perlio fails t/lib/dprof.t because Dprof.xs calls PerlIO_tell() and PerlIO_seek() and the dummy crlf layer is not making adjustments for CRLF translation happening in C runtime. All other tests pass. Added note to README.win32 to point out the snags of doing a perl build with Norton AntiVirus turned on. Tweaked t/pragma/warnings.t so that when run stand-alone you can tell which file a fail comes from. Updated "canned" config.h to match the one generated. p4raw-id: //depot/perlio@7802
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/perlio.c b/perlio.c
index 5df3d2de6b..925e3fb60f 100644
--- a/perlio.c
+++ b/perlio.c
@@ -193,8 +193,10 @@ PerlIO_cleantable(PerlIO **tablep)
for (i=PERLIO_TABLE_SIZE-1; i > 0; i--)
{
PerlIO *f = table+i;
- if (*f)
- PerlIO_close(f);
+ if (*f)
+ {
+ PerlIO_close(f);
+ }
}
Safefree(table);
*tablep = NULL;
@@ -1276,7 +1278,8 @@ PerlIOStdio_tell(PerlIO *f)
IV
PerlIOStdio_close(PerlIO *f)
{
- return fclose(PerlIOSelf(f,PerlIOStdio)->stdio);
+ FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
+ return fclose(stdio);
}
IV
@@ -1309,8 +1312,12 @@ PerlIOStdio_fill(PerlIO *f)
{
FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio;
int c;
- if (fflush(stdio) != 0)
- return EOF;
+ /* fflush()ing read-only streams can cause trouble on some stdio-s */
+ if ((PerlIOBase(f)->flags & PERLIO_F_CANWRITE))
+ {
+ if (fflush(stdio) != 0)
+ return EOF;
+ }
c = fgetc(stdio);
if (c == EOF || ungetc(c,stdio) != c)
return EOF;
@@ -1547,14 +1554,15 @@ PerlIOBuf_flush(PerlIO *f)
/* write() the buffer */
STDCHAR *p = b->buf;
int count;
+ PerlIO *n = PerlIONext(f);
while (p < b->ptr)
{
- count = PerlIO_write(PerlIONext(f),p,b->ptr - p);
+ count = PerlIO_write(n,p,b->ptr - p);
if (count > 0)
{
p += count;
}
- else if (count < 0)
+ else if (count < 0 || PerlIO_error(n))
{
PerlIOBase(f)->flags |= PERLIO_F_ERROR;
code = -1;