2 * ungetc.c - push a character back onto an input stream
4 /* $Id: ungetc.c,v 1.4 1994/06/24 11:51:56 ceriel Exp $ */
10 ungetc(int ch, FILE *stream)
14 if (ch == EOF || !io_testflag(stream,_IOREADING))
16 if (stream->_ptr == stream->_buf) {
17 if (stream->_count != 0) return EOF;
21 p = --(stream->_ptr); /* ??? Bloody vax assembler !!! */
22 /* ungetc() in sscanf() shouldn't write in rom */
23 if (*p != (unsigned char) ch)
24 *p = (unsigned char) ch;