1*26665Sdonn #if defined(LIBC_SCCS) && !defined(lint) 2*26665Sdonn static char sccsid[] = "@(#)ungetc.c 5.2 (Berkeley) 03/09/86"; 3*26665Sdonn #endif LIBC_SCCS and not lint 415084Ssam 52037Swnj #include <stdio.h> 62037Swnj 72037Swnj ungetc(c, iop) 815084Ssam register FILE *iop; 92037Swnj { 1017951Sserge if (c == EOF || (iop->_flag & (_IOREAD|_IORW)) == 0 || 1117951Sserge iop->_ptr == NULL || iop->_base == NULL) 1217951Sserge return (EOF); 1317951Sserge 1417951Sserge if (iop->_ptr == iop->_base) 1517951Sserge iop->_ptr++; 1617951Sserge 172037Swnj iop->_cnt++; 182037Swnj *--iop->_ptr = c; 1917951Sserge 2015084Ssam return (c); 212037Swnj } 22