summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-06-10 12:27:51 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-06-10 12:27:51 +0000
commit92bff44d1afc92cdac64a832f4753e65c2d1454b (patch)
treee5a135ba2e2c034f369452af8a97716d08153a67 /perlio.c
parent3b050a92605e8ca176aeb951cf91db11faf40e0b (diff)
downloadperl-92bff44d1afc92cdac64a832f4753e65c2d1454b.tar.gz
Paper over a crack or two with USE_SFIO
p4raw-id: //depot/perlio@10497
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/perlio.c b/perlio.c
index b415b5a9d6..005e7f81e1 100644
--- a/perlio.c
+++ b/perlio.c
@@ -112,7 +112,11 @@ PerlIO_destruct(pTHX)
int
PerlIO_binmode(pTHX_ PerlIO *fp, int iotype, int mode, const char *names)
{
+#ifdef USE_SFIO
+ return 1;
+#else
return perlsio_binmode(fp,iotype,mode);
+#endif
}
/* De-mux PerlIO_openn() into fdopen, freopen and fopen type entries */
@@ -206,6 +210,28 @@ PerlIO_init(void)
sfset(sfstdout,SF_SHARE,0);
}
+PerlIO *
+PerlIO_importFILE(FILE *stdio, int fl)
+{
+ int fd = fileno(stdio);
+ PerlIO *r = PerlIO_fdopen(fd,"r+");
+ return r;
+}
+
+FILE *
+PerlIO_findFILE(PerlIO *pio)
+{
+ int fd = PerlIO_fileno(pio);
+ FILE *f = fdopen(fd,"r+");
+ PerlIO_flush(pio);
+ if (!f && errno == EINVAL)
+ f = fdopen(fd,"w");
+ if (!f && errno == EINVAL)
+ f = fdopen(fd,"r");
+ return f;
+}
+
+
#else /* USE_SFIO */
/*======================================================================================*/
/* Implement all the PerlIO interface ourselves.
@@ -1938,7 +1964,7 @@ PerlIOUnix_write(PerlIO *f, const void *vbuf, Size_t count)
IV
PerlIOUnix_seek(PerlIO *f, Off_t offset, int whence)
{
- dSYS;
+ dSYS;
Off_t new = PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,offset,whence);
PerlIOBase(f)->flags &= ~PERLIO_F_EOF;
return (new == (Off_t) -1) ? -1 : 0;