|
|
1.1 ! root 1: /* ! 2: * libc/stdio/ftell.c ! 3: * ANSI-compliant C standard i/o library. ! 4: * ftell() ! 5: * ANSI 4.9.9.4. ! 6: * Find logical file position on stream. ! 7: */ ! 8: ! 9: #include <stdio.h> ! 10: #include <errno.h> ! 11: ! 12: #define EFGETPOS EINVAL ! 13: ! 14: long ! 15: ftell(stream) register FILE *stream; ! 16: { ! 17: register long offset; ! 18: register _FILE2 *f2p; ! 19: ! 20: f2p = stream->_f2p; ! 21: ! 22: if ((offset=lseek(fileno(stream), 0L, SEEK_CUR)) == -1L) { ! 23: errno = EFGETPOS; ! 24: return offset; ! 25: } ! 26: if (f2p->_bp!=NULL) ! 27: offset += stream->_cp - f2p->_dp; ! 28: if (stream->_ff2&_FUNGOT) ! 29: --offset; ! 30: return offset; ! 31: } ! 32: ! 33: /* end of libc/stdio/ftell.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.