int xio_getc_pgm(struct __file *stream) { if ((PGM.flags & XIO_FLAG_EOF_bm) != 0) { PGM.signal = XIO_SIG_EOF; return (_FDEV_EOF); } if ((PGM.c = pgm_read_byte(&PGMf.filebase_P[PGMf.rd_offset])) == NUL) { PGM.flags |= XIO_FLAG_EOF_bm; } ++PGMf.rd_offset; if (LINEMODE(PGM.flags) == 0) { // processing is simple if not LINEMODE if (ECHO(PGM.flags) != 0) { putchar(PGM.c); } return (PGM.c); } // now do the LINEMODE stuff if (PGM.c == NUL) { // perform newline substitutions PGM.c = '\n'; } else if (PGM.c == '\r') { PGM.c = '\n'; // } else if ((SEMICOLONS(PGM.flags) != 0) && (PGM.c == ';')) { // PGM.c = '\n'; } if (ECHO(PGM.flags) != 0) { putchar(PGM.c); } return (PGM.c); }
static int _getc_NEWLINE(void) // convert CRs and LFs to newlines if line mode { if (LINEMODE(ds[gdev].flags) != 0) { ds[gdev].c = '\n'; } if (ECHO(ds[gdev].flags) != 0) { ds[gdev].x_putc(ds[gdev].c, stdout); } return(ds[gdev].c); }