From: Nick Ing-Simmons Date: Thu, 23 Nov 2000 23:04:05 +0000 (+0000) Subject: Win32 passes all but t/lib/peek.t with perlio and home-grown crlf. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63dbdb066b93ac25a070d3a7942d248c23ec6088;p=p5sagit%2Fp5-mst-13.2.git Win32 passes all but t/lib/peek.t with perlio and home-grown crlf. peek fail is showing a real problem (multiple crlf layers are getting pushed.) p4raw-id: //depot/perlio@7843 --- diff --git a/doio.c b/doio.c index 914f91c..bf4d878 100644 --- a/doio.c +++ b/doio.c @@ -528,7 +528,7 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw, } } } - else if (O_BINARY != O_TEXT) { + else if (O_BINARY != O_TEXT && IoTYPE(io) != IoTYPE_STD) { type = ":crlf"; } } diff --git a/perlio.c b/perlio.c index 697fc86..69aba4b 100644 --- a/perlio.c +++ b/perlio.c @@ -2156,12 +2156,36 @@ PerlIOCrlf_set_ptrcnt(PerlIO *f, STDCHAR *ptr, SSize_t cnt) PerlIO_get_base(f); if (!ptr) { - ptr = ((c->nl) ? (c->nl+1) : b->end) - cnt; + if (c->nl) + ptr = c->nl+1; + else + { + ptr = b->end; + if (ptr > b->buf && ptr[-1] == 0xd) + ptr--; + } + ptr -= cnt; } else { - if (ptr != (((c->nl) ? (c->nl+1) : b->end) - cnt)) - abort(); + /* Test code - delete when it works ... */ + STDCHAR *chk; + if (c->nl) + chk = c->nl+1; + else + { + chk = b->end; + if (chk > b->buf && chk[-1] == 0xd) + chk--; + } + chk -= cnt; + + if (ptr != chk) + { + dTHX; + Perl_croak(aTHX_ "ptr wrong %p != %p nl=%p e=%p for %d", + ptr, chk, c->nl, b->end, cnt); + } } if (c->nl) { diff --git a/win32/makefile.mk b/win32/makefile.mk index 5ccba23..ad5429d 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -371,7 +371,7 @@ a = .a # Options # -INCLUDES = -I$(COREDIR) -I.\include -I. -I.. +INCLUDES = -I.\include -I. -I.. -I$(COREDIR) DEFINES = -DWIN32 $(CRYPT_FLAG) LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console