From: David Dyck Date: Fri, 28 Jul 2000 17:19:16 +0000 (-0700) Subject: Fix for X-Git-Tag: accepted/trunk/20130322.191538~33738 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=226017aa9f191225e17de7d54c163349da3c3065;p=platform%2Fupstream%2Fperl.git Fix for Subject: [ID 20000728.005] perl -P broken Message-Id: <200007290019.RAA08484@dd.tc.fluke.com> (hopefully). The fix is also not complete, it seems to break BOM swallowing for libc5 systems, but until someone figures out a way to do this without ftell(), this will do. p4raw-id: //depot/perl@7570 --- diff --git a/toke.c b/toke.c index 64b6925..98ef9b9 100644 --- a/toke.c +++ b/toke.c @@ -2520,8 +2520,26 @@ Perl_yylex(pTHX) goto retry; } do { - bool bof; - bof = PL_rsfp && (PerlIO_tell(PL_rsfp) == 0); /* *Before* read! */ + bool bof = PL_rsfp ? TRUE : FALSE; + if (bof) { +#ifdef PERLIO_IS_STDIO +# ifdef __GLIBC__ +# if __GLIBC__ == 1 /* Linux glibc5 */ +# define FTELL_FOR_PIPE_IS_BROKEN +# endif +# endif +#endif +#ifdef FTELL_FOR_PIPE_IS_BROKEN + /* This loses the possibility to detect the bof + * situation on perl -P when the libc5 is being used. + * Workaround? Maybe attach some extra state to PL_rsfp? + */ + if (!PL_preprocess) + bof = PerlIO_tell(PL_rsfp) == 0; +#else + bof = PerlIO_tell(PL_rsfp) == 0; +#endif + } s = filter_gets(PL_linestr, PL_rsfp, 0); if (s == Nullch) { fake_eof: