xref: /csrg-svn/usr.bin/pascal/libpc/TEOLN.c (revision 7765)
11709Smckusick /* Copyright (c) 1979 Regents of the University of California */
21709Smckusick 
3*7765Smckusick static char sccsid[] = "@(#)TEOLN.c 1.4 08/16/82";
41709Smckusick 
51709Smckusick #include "h00vars.h"
61709Smckusick 
73036Smckusic bool
81709Smckusick TEOLN(filep)
91709Smckusick 
101709Smckusick 	register struct iorec	*filep;
111709Smckusick {
12*7765Smckusick 	if (filep->fblk >= MAXFILES || _actfile[filep->fblk] != filep ||
13*7765Smckusick 	    (filep->funit & FDEF)) {
143869Smckusic 		ERROR("Reference to an inactive file\n", 0);
151709Smckusick 		return;
161709Smckusick 	}
17*7765Smckusick 	if (filep->funit & FWRITE) {
18*7765Smckusick 		ERROR("%s: eoln is undefined on files open for writing\n",
19*7765Smckusick 		    filep->pfname);
20*7765Smckusick 		return;
21*7765Smckusick 	}
221709Smckusick 	IOSYNC(filep);
23*7765Smckusick 	if (filep->funit & EOFF) {
24*7765Smckusick 		ERROR("%s: eoln is undefined when eof is true\n",
25*7765Smckusick 		    filep->pfname);
26*7765Smckusick 		return;
27*7765Smckusick 	}
281709Smckusick 	if (filep->funit & EOLN)
291709Smckusick 		return TRUE;
301709Smckusick 	return FALSE;
311709Smckusick }
32