X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perlio.c;h=6945a75069a719dde5cc877fef2a17476d68d2f0;hb=dd629d5bb3bd7014585b7aad3c6715a5011673bc;hp=a2e979ab6fe464e7e2bfc92f8cb717634aa6ef6e;hpb=a20bf0c3d4388ee237405eea459c5f4080c80cef;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perlio.c b/perlio.c index a2e979a..6945a75 100644 --- a/perlio.c +++ b/perlio.c @@ -1,13 +1,12 @@ /* perlio.c * - * Copyright (c) 1996-1999, Nick Ing-Simmons + * Copyright (c) 1996-2000, Nick Ing-Simmons * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ -#if !defined(PERL_IMPLICIT_SYS) #define VOIDUSED 1 #include "config.h" @@ -26,6 +25,8 @@ #define PERL_IN_PERLIO_C #include "perl.h" +#if !defined(PERL_IMPLICIT_SYS) + #ifdef PERLIO_IS_STDIO void @@ -157,8 +158,8 @@ PerlIO_set_cnt(PerlIO *f, int cnt) void PerlIO_set_ptrcnt(PerlIO *f, STDCHAR *ptr, int cnt) { -#ifdef FILE_bufsiz dTHX; +#ifdef FILE_bufsiz STDCHAR *e = FILE_base(f) + FILE_bufsiz(f); int ec = e - ptr; if (ptr > e + 1 && ckWARN_d(WARN_INTERNAL)) @@ -167,16 +168,14 @@ PerlIO_set_ptrcnt(PerlIO *f, STDCHAR *ptr, int cnt) Perl_warner(aTHX_ WARN_INTERNAL, "Setting cnt to %d, ptr implies %d\n",cnt,ec); #endif #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) - FILE_ptr(f) = ptr; + FILE_ptr(f) = ptr; #else - dTHX; - Perl_croak(aTHX_ "Cannot set 'ptr' of FILE * on this system"); + Perl_croak(aTHX_ "Cannot set 'ptr' of FILE * on this system"); #endif #if defined(USE_STDIO_PTR) && defined(STDIO_CNT_LVALUE) - FILE_cnt(f) = cnt; + FILE_cnt(f) = cnt; #else - dTHX; - Perl_croak(aTHX_ "Cannot set 'cnt' of FILE * on this system"); + Perl_croak(aTHX_ "Cannot set 'cnt' of FILE * on this system"); #endif } @@ -387,7 +386,7 @@ PerlIO_vprintf(PerlIO *f, const char *fmt, va_list ap) Off_t PerlIO_tell(PerlIO *f) { -#ifdef HAS_FTELLO +#if defined(USE_64_BIT_STDIO) && defined(HAS_FTELLO) && !defined(USE_FTELL64) return ftello(f); #else return ftell(f); @@ -398,7 +397,7 @@ PerlIO_tell(PerlIO *f) int PerlIO_seek(PerlIO *f, Off_t offset, int whence) { -#ifdef HAS_FSEEKO +#if defined(USE_64_BIT_STDIO) && defined(HAS_FSEEKO) && !defined(USE_FSEEK64) return fseeko(f,offset,whence); #else return fseek(f,offset,whence); @@ -496,7 +495,11 @@ PerlIO_setpos(PerlIO *f, const Fpos_t *pos) int PerlIO_setpos(PerlIO *f, const Fpos_t *pos) { +#if defined(USE_64_BIT_STDIO) && defined(USE_FSETPOS64) + return fsetpos64(f, pos); +#else return fsetpos(f, pos); +#endif } #endif #endif @@ -515,7 +518,11 @@ PerlIO_getpos(PerlIO *f, Fpos_t *pos) int PerlIO_getpos(PerlIO *f, Fpos_t *pos) { +#if defined(USE_64_BIT_STDIO) && defined(USE_FSETPOS64) + return fgetpos64(f, pos); +#else return fgetpos(f, pos); +#endif } #endif #endif @@ -547,11 +554,9 @@ PerlIO_vsprintf(char *s, int n, const char *fmt, va_list ap) { if (strlen(s) >= (STRLEN)n) { - PerlIO_puts(PerlIO_stderr(),"panic: sprintf overflow - memory corrupted!\n"); - { - dTHX; - my_exit(1); - } + dTHX; + PerlIO_puts(Perl_error_log,"panic: sprintf overflow - memory corrupted!\n"); + my_exit(1); } } return val;