CR-LF support broken for formats
authorGurusamy Sarathy <gsar@cpan.org>
Thu, 30 Dec 1999 04:36:12 +0000 (04:36 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Thu, 30 Dec 1999 04:36:12 +0000 (04:36 +0000)
p4raw-id: //depot/perl@4738

toke.c

diff --git a/toke.c b/toke.c
index 18e95bd..452b20c 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -6894,6 +6894,14 @@ S_scan_formline(pTHX_ register char *s)
                    needargs = TRUE;
            }
            sv_catpvn(stuff, s, eol-s);
+#ifndef PERL_STRICT_CR
+           if (eol-s > 1 && eol[-2] == '\r' && eol[-1] == '\n') {
+               char *end = SvPVX(stuff) + SvCUR(stuff);
+               end[-2] = '\n';
+               end[-1] = '\0';
+               SvCUR(stuff)--;
+           }
+#endif
        }
        s = eol;
        if (PL_rsfp) {