Annotation of 43BSD/lib/libc/stdio/ungetc.c, revision 1.1.1.1

1.1       root        1: #if defined(LIBC_SCCS) && !defined(lint)
                      2: static char sccsid[] = "@(#)ungetc.c   5.3 (Berkeley) 3/26/86";
                      3: #endif LIBC_SCCS and not lint
                      4: 
                      5: #include <stdio.h>
                      6: 
                      7: ungetc(c, iop)
                      8:        register FILE *iop;
                      9: {
                     10:        if (c == EOF || (iop->_flag & (_IOREAD|_IORW)) == 0 ||
                     11:            iop->_ptr == NULL || iop->_base == NULL)
                     12:                return (EOF);
                     13: 
                     14:        if (iop->_ptr == iop->_base)
                     15:                if (iop->_cnt == 0)
                     16:                        iop->_ptr++;
                     17:                else
                     18:                        return (EOF);
                     19: 
                     20:        iop->_cnt++;
                     21:        *--iop->_ptr = c;
                     22: 
                     23:        return (c);
                     24: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.