/*
- * perlio.c Copyright (c) 1996-2001, Nick Ing-Simmons You may distribute
+ * perlio.c Copyright (c) 1996-2002, Nick Ing-Simmons You may distribute
* under the terms of either the GNU General Public License or the
* Artistic License, as specified in the README file.
*/
/*
+ * Hour after hour for nearly three weary days he had jogged up and down,
+ * over passes, and through long dales, and across many streams.
+ */
+
+/*
* If we have ActivePerl-like PERL_IMPLICIT_SYS then we need a dTHX to get
* at the dispatch tables, even when we do not need it for other reasons.
* Invent a dSYS macro to abstract this out
if (fd >= 0) {
char mode[8];
int omode = fcntl(fd, F_GETFL);
+#ifdef DJGPP
+ omode = djgpp_get_stream_mode(f);
+#endif
PerlIO_intmode2str(omode,mode,NULL);
/* the r+ is a hack */
return PerlIO_fdopen(fd, mode);
* seen as an invalid separator character.
*/
char q = ((*s == '\'') ? '"' : '\'');
- Perl_warn(aTHX_
+ if (ckWARN(WARN_LAYER))
+ Perl_warner(aTHX_ packWARN(WARN_LAYER),
"perlio: invalid separator character %c%c%c in layer specification list %s",
q, *s, q, s);
return -1;
*/
case '\0':
e--;
- Perl_warn(aTHX_
+ if (ckWARN(WARN_LAYER))
+ Perl_warner(aTHX_ packWARN(WARN_LAYER),
"perlio: argument list not closed for layer \"%.*s\"",
(int) (e - s), s);
return -1;
}
}
if (e > s) {
+ bool warn_layer = ckWARN(WARN_LAYER);
PerlIO_funcs *layer =
PerlIO_find_layer(aTHX_ s, llen, 1);
if (layer) {
&PL_sv_undef);
}
else {
- Perl_warn(aTHX_ "perlio: unknown layer \"%.*s\"",
+ if (warn_layer)
+ Perl_warner(aTHX_ packWARN(WARN_LAYER), "perlio: unknown layer \"%.*s\"",
(int) llen, s);
return -1;
}
PerlIO_get_base(f);
if (PerlIOBase(f)->flags & PERLIO_F_RDBUF) {
PerlIOCrlf *c = PerlIOSelf(f, PerlIOCrlf);
- if ((PerlIOBase(f)->flags & PERLIO_F_CRLF) && !c->nl) {
- STDCHAR *nl = b->ptr;
+ if ((PerlIOBase(f)->flags & PERLIO_F_CRLF) && (!c->nl || *c->nl == 0xd)) {
+ STDCHAR *nl = (c->nl) ? c->nl : b->ptr;
scan:
while (nl < b->end && *nl != 0xd)
nl++;
ptr -= cnt;
}
else {
+#if 1
/*
* Test code - delete when it works ...
*/
chk -= cnt;
if (ptr != chk ) {
- Perl_warn(aTHX_ "ptr wrong %p != %p fl=%08" UVxf
+ Perl_croak(aTHX_ "ptr wrong %p != %p fl=%08" UVxf
" nl=%p e=%p for %d", ptr, chk, flags, c->nl,
b->end, cnt);
}
+#endif
}
if (c->nl) {
if (ptr > c->nl) {