|
|
1.1 ! root 1: /* ! 2: * Standard I/O Library ! 3: * Seek; first ensure buffer is clean; afterwards put ptrs at right place. ! 4: */ ! 5: ! 6: #include <stdio.h> ! 7: ! 8: int ! 9: fseek(fp, offset, origin) ! 10: register FILE *fp; ! 11: long offset; ! 12: int origin; ! 13: { ! 14: long lseek(); ! 15: ! 16: if ((origin == SEEK_CUR) && (fp->_ff & _FUNGOT)) ! 17: offset--; ! 18: if (_fpseek(fp)==EOF) ! 19: return (EOF); ! 20: if ((offset=lseek(fileno(fp), offset, origin)) == -1L) ! 21: return (EOF); ! 22: if (fp->_bp!=NULL) ! 23: fp->_dp = fp->_cp = fp->_bp + (unsigned)offset%BUFSIZ; ! 24: fp->_ff &= ~_FEOF; ! 25: return (0); ! 26: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.