X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=doio.c;h=0d5742526957a08e40992bd3674db6237343baf8;hb=a9581ec21a2686ca09657757555fcd66435bb205;hp=829d6d920f72c917266f24a04c8b0ae50c58b106;hpb=96e4d5b14cf2dfb0235faa8bc3f701c15b15bb05;p=p5sagit%2Fp5-mst-13.2.git diff --git a/doio.c b/doio.c index 829d6d9..0d57425 100644 --- a/doio.c +++ b/doio.c @@ -667,13 +667,10 @@ GV *gv; if (PerlIO_eof(fp)) (void)PerlIO_seek(fp, 0L, 2); /* ultrix 1.2 workaround */ #endif - if (op->op_type == OP_SYSTELL) - return lseek(PerlIO_fileno(fp), 0L, 1); - else - return PerlIO_tell(fp); + return PerlIO_tell(fp); } if (dowarn) - warn("%s() on unopened file", op_name[op->op_type]); + warn("tell() on unopened file"); SETERRNO(EBADF,RMS$_IFI); return -1L; } @@ -692,17 +689,31 @@ 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("%s() on unopened file", op_name[op->op_type]); + warn("seek() on unopened file"); SETERRNO(EBADF,RMS$_IFI); 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