home *** CD-ROM | disk | FTP | other *** search
- 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;
- }
-
-