Annotation of coherent/b/lib/libc/XSTDIO/_fpseek.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * libc/stdio/_fpseek.c
                      3:  * ANSI-compliant C standard i/o library internals.
                      4:  * _fpseek()
                      5:  * Align file seek address with current pointer in buffer.
                      6:  */
                      7: 
                      8: #include <stdio.h>
                      9: 
                     10: int
                     11: _fpseek(fp) register FILE *fp;
                     12: {
                     13:        register _FILE2 *f2p;
                     14: 
                     15:        f2p = fp->_f2p;
                     16:        if (fp->_ff2 & _FUNGOT)
                     17:                (*f2p->_gt)(fp);        /* Discard ungotten character */
                     18:        if (f2p->_dp <= fp->_cp)
                     19:                return fflush(fp);      /* Flush buffered output */
                     20:        if (lseek(fileno(fp), (long)(fp->_cp-f2p->_dp), SEEK_CUR) == -1L)
                     21:                return EOF;             /* Seek back over unread input */
                     22:        f2p->_dp = fp->_cp;
                     23:        fp->_cc = 0;
                     24:        return 0;
                     25: }
                     26: 
                     27: /* end of libc/stdio/_fpseek.c */

unix.superglobalmegacorp.com

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