|
|
1.1 ! root 1: /* ! 2: * Standard I/O Library ! 3: * Tell logical (vs physical) file position ! 4: * in units compatible with fseek ! 5: */ ! 6: ! 7: #include <stdio.h> ! 8: ! 9: long ! 10: ftell(fp) ! 11: register FILE *fp; ! 12: { ! 13: extern long lseek(); ! 14: long offset; ! 15: ! 16: if ((offset=lseek(fileno(fp), 0L, SEEK_CUR)) == -1L) ! 17: return (-1L); ! 18: if (fp->_bp!=NULL) ! 19: offset += fp->_cp - fp->_dp; ! 20: if (fp->_ff&_FUNGOT) ! 21: --offset; ! 22: return (offset); ! 23: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.