Annotation of coherent/d/lib/libc/stdio/_fpseek.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Standard I/O Library Internals
        !             3:  * Align file seek addr with current pointer in buffer
        !             4:  * by writing out unflushed data or seeking back over unread data
        !             5:  * ungot char is discarded
        !             6:  */
        !             7: 
        !             8: #include <stdio.h>
        !             9: 
        !            10: int
        !            11: _fpseek(fp)
        !            12: register FILE  *fp;
        !            13: {
        !            14:        extern  long    lseek();
        !            15: 
        !            16:        if (fp->_ff&_FUNGOT)
        !            17:                (*fp->_gt)(fp);
        !            18:        if (fp->_dp <= fp->_cp)
        !            19:                return (fflush(fp));
        !            20:        if (lseek(fileno(fp), (long)(fp->_cp-fp->_dp), SEEK_CUR) == -1L)
        !            21:                return (EOF);
        !            22:        fp->_dp = fp->_cp;
        !            23:        fp->_cc = 0;
        !            24:        return (0);
        !            25: }

unix.superglobalmegacorp.com

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