/*
* Blast - found CR as last char in buffer
*/
+
if (b->ptr < nl) {
/*
* They may not care, defer work as long as
* possible
*/
+ c->nl = nl;
return (nl - b->ptr);
}
else {
/*
* CR at EOF - just fall through
*/
+ /* Should we clear EOF though ??? */
}
}
}
if (!b->buf)
PerlIO_get_base(f);
if (!ptr) {
- if (c->nl)
+ if (c->nl) {
ptr = c->nl + 1;
+ if (ptr == b->end && *c->nl == 0xd) {
+ /* Defered CR at end of buffer case - we lied about count */
+ ptr--;
+ }
+ }
else {
ptr = b->end;
- if ((flags & PERLIO_F_CRLF) && ptr > b->buf && ptr[-1] == 0xd)
- ptr--;
}
ptr -= cnt;
}
* Test code - delete when it works ...
*/
STDCHAR *chk = (c->nl) ? (c->nl+1) : b->end;
+ if (ptr+cnt == c->nl && c->nl+1 == b->end && *c->nl == 0xd) {
+ /* Defered CR at end of buffer case - we lied about count */
+ chk--;
+ }
chk -= cnt;
- if (ptr != chk) {
- Perl_croak(aTHX_ "ptr wrong %p != %p fl=%08" UVxf
+ if (ptr != chk ) {
+ Perl_warn(aTHX_ "ptr wrong %p != %p fl=%08" UVxf
" nl=%p e=%p for %d", ptr, chk, flags, c->nl,
b->end, cnt);
}