summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-12-30 19:35:07 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-12-30 19:35:07 +0000
commit53129d29569a85455957955379fd49abdaaf8185 (patch)
treee5ec616a792a9b6e0a815dfcd1f645948d9b4aff /toke.c
parentc39cd00800303e8967294e98aa4c427a1872a251 (diff)
downloadperl-53129d29569a85455957955379fd49abdaaf8185.tar.gz
leave DATA open in binmode if __END__ line doesn't have CRLF
p4raw-id: //depot/perl@4740
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index da3c7fdd5d..f35a0421f3 100644
--- a/toke.c
+++ b/toke.c
@@ -3808,8 +3808,10 @@ Perl_yylex(pTHX)
IoTYPE(GvIOp(gv)) = '<';
#if defined(WIN32) && !defined(PERL_TEXTMODE_SCRIPTS)
/* if the script was opened in binmode, we need to revert
- * it to text mode for compatibility.
+ * it to text mode for compatibility; but only iff it has CRs
* XXX this is a questionable hack at best. */
+ if (PL_bufend-PL_bufptr > 2
+ && PL_bufend[-1] == '\n' && PL_bufend[-2] == '\r')
{
Off_t loc = 0;
if (IoTYPE(GvIOp(gv)) == '<') {