ack/lang/cem/libcc/stdio/ungetc.c
1987-01-27 15:57:55 +00:00

17 lines
255 B
C

#include <stdio.h>
ungetc(ch, iop)
int ch;
FILE *iop;
{
if ( ch < 0 || !io_testflag(iop,IO_READMODE))
return EOF;
if (iop->_ptr == iop->_buf) {
if (iop->_count != 0) return EOF;
iop->_ptr++;
}
iop->_count++;
*--iop->_ptr = ch;
return(ch);
}