1: /* @(#)ftell.c 2.1 SCCS id keyword */
2: /*
3: * Return file offset.
4: * Coordinates with buffering.
5: */
6:
7: #include <stdio.h>
8: long lseek();
9:
10:
11: long ftell(iop)
12: FILE *iop;
13: {
14: long tres;
15: register adjust;
16:
17: if (iop->_cnt < 0)
18: iop->_cnt = 0;
19: if (iop->_flag&_IOREAD)
20: adjust = - iop->_cnt;
21: else if(iop->_flag&(_IOWRT|_IORW)) {
22: adjust = 0;
23: if (iop->_flag&_IOWRT && iop->_base && (iop->_flag&_IONBF)==0)
24: adjust = iop->_ptr - iop->_base;
25: } else
26: return(-1);
27: tres = lseek(fileno(iop), 0L, 1);
28: if (tres<0)
29: return(tres);
30: tres += adjust;
31: return(tres);
32: }
Defined functions
ftell
defined in line
11; used 60 times
- in /usr/include/stdio.h line
49
- in /usr/src/cmd/diff/diffreg.c line
628
- in /usr/src/cmd/grep.c line
58,
463
- in /usr/src/cmd/join.c line
31,
103-108(2),
116
- in /usr/src/cmd/look.c line
58,
85
- in /usr/src/cmd/mail.c line
47,
365,
378
- in /usr/src/cmd/nm.c line
34,
287
- in /usr/src/cmd/prof.c line
122
- in /usr/src/cmd/ranlib.c line
11,
111
- in /usr/src/cmd/refer/util/inv2.c line
13,
21
- in /usr/src/cmd/refer/util/mkey2.c line
89
- in /usr/src/cmd/remind/delrem.c line
261
- in /usr/src/cmd/struct/1.line.c line
11,
91
- in /usr/src/games/fortune/strfile.c line
46,
92,
109-110(2)
- in /usr/src/games/fortune/unstr.c line
58
- in /usr/src/lib/libI77/backspace.c line
34
- in /usr/src/lib/libI77/dfe.c line
60
- in /usr/src/lib/libI77/endfile.c line
47-49(2)
- in /usr/src/lib/libI77/err.c line
110
- in /usr/src/lib/libI77/fio.h line
18
- in /usr/src/lib/libI77/inquire.c line
97
- in /usr/src/lib/libI77/ioprim.c line
160
- in /usr/src/lib/libI77/sue.c line
37,
68
- in /usr/src/lib/libI77/util.c line
55,
102
- in /usr/src/lib/libU77/ftell_.c line
28
- in /usr/src/ucb/Mail/aux.c line
257
- in /usr/src/ucb/ctags.c line
36,
371,
473
- in /usr/src/ucb/delivermail/vax-mail.c line
62,
509,
526
- in /usr/src/ucb/mkstr.c line
10,
242
- in /usr/src/ucb/msgs/msgs.c line
99,
629,
676,
746,
787
- in /usr/src/ucb/strings.c line
7,
109
- in /usr/src/ucb/sysline.c line
912-914(2)