X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=doio.c;h=0d5742526957a08e40992bd3674db6237343baf8;hb=a9581ec21a2686ca09657757555fcd66435bb205;hp=b8c5a0665c50351bb2a02503b38480e5e8a1f2f9;hpb=137443ea0a858c43f5a720730cac6209a7d41948;p=p5sagit%2Fp5-mst-13.2.git diff --git a/doio.c b/doio.c index b8c5a06..0d57425 100644 --- a/doio.c +++ b/doio.c @@ -660,22 +660,15 @@ do_tell(gv) GV *gv; { register IO *io; + register PerlIO *fp; - if (!gv) - goto phooey; - - io = GvIO(gv); - if (!io || !IoIFP(io)) - goto phooey; - + if (gv && (io = GvIO(gv)) && (fp = IoIFP(io))) { #ifdef ULTRIX_STDIO_BOTCH - if (PerlIO_eof(IoIFP(io))) - (void)PerlIO_seek (IoIFP(io), 0L, 2); /* ultrix 1.2 workaround */ + if (PerlIO_eof(fp)) + (void)PerlIO_seek(fp, 0L, 2); /* ultrix 1.2 workaround */ #endif - - return PerlIO_tell(IoIFP(io)); - -phooey: + return PerlIO_tell(fp); + } if (dowarn) warn("tell() on unopened file"); SETERRNO(EBADF,RMS$_IFI); @@ -696,10 +689,7 @@ int whence; if (PerlIO_eof(fp)) (void)PerlIO_seek(fp, 0L, 2); /* ultrix 1.2 workaround */ #endif - if (op->op_type == OP_SYSSEEK) - return lseek(PerlIO_fileno(fp), pos, whence) >= 0; - else - return PerlIO_seek(fp, pos, whence) >= 0; + return PerlIO_seek(fp, pos, whence) >= 0; } if (dowarn) warn("seek() on unopened file"); @@ -707,6 +697,23 @@ int whence; return FALSE; } +long +do_sysseek(gv, pos, whence) +GV *gv; +long pos; +int whence; +{ + register IO *io; + register PerlIO *fp; + + if (gv && (io = GvIO(gv)) && (fp = IoIFP(io))) + return lseek(PerlIO_fileno(fp), pos, whence); + if (dowarn) + warn("sysseek() on unopened file"); + SETERRNO(EBADF,RMS$_IFI); + return -1L; +} + #if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) && defined(F_FREESP) /* code courtesy of William Kucharski */ #define HAS_CHSIZE