1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1987-01-27 15:57:55 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
ungetc(ch, iop)
|
|
|
|
int ch;
|
1987-02-06 14:44:56 +00:00
|
|
|
register FILE *iop;
|
1987-01-27 15:57:55 +00:00
|
|
|
{
|
1987-02-06 14:44:56 +00:00
|
|
|
unsigned char *p;
|
|
|
|
|
1987-01-27 15:57:55 +00:00
|
|
|
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++;
|
1987-02-06 14:44:56 +00:00
|
|
|
p = --(iop->_ptr); /* ??? Bloody vax assembler !!! */
|
|
|
|
*p = ch;
|
1987-01-27 15:57:55 +00:00
|
|
|
return(ch);
|
|
|
|
}
|