blob: a1512cd2b036c193c6d2373b2b5d95df0aa5cf2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
bool
do_eof(stab)
STAB *stab;
{
register STIO *stio;
int ch;
if (!stab) { /* eof() */
if (argvstab)
stio = stab_io(argvstab);
else
return TRUE;
}
else
stio = stab_io(stab);
if (!stio)
return TRUE;
while (stio->ifp) {
#ifdef STDSTDIO /* (the code works without this) */
if (stio->ifp->_cnt > 0) /* cheat a little, since */
return FALSE; /* this is the most usual case */
#endif
ch = getc(stio->ifp);
if (ch != EOF) {
(void)ungetc(ch, stio->ifp);
return FALSE;
}
#ifdef STDSTDIO
if (stio->ifp->_cnt < -1)
stio->ifp->_cnt = -1;
#endif
if (!stab) { /* not necessarily a real EOF yet? */
if (!nextargv(argvstab)) /* get another fp handy */
return TRUE;
}
else
return TRUE; /* normal fp, definitely end of file */
}
return TRUE;
}
|