xref: /csrg-svn/usr.bin/pascal/libpc/TEOLN.c (revision 62096)
140865Sbostic /*-
2*62096Sbostic  * Copyright (c) 1979, 1993
3*62096Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71709Smckusick 
840865Sbostic #ifndef lint
9*62096Sbostic static char sccsid[] = "@(#)TEOLN.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111709Smckusick 
121709Smckusick #include "h00vars.h"
131709Smckusick 
143036Smckusic bool
TEOLN(filep)151709Smckusick TEOLN(filep)
161709Smckusick 
171709Smckusick 	register struct iorec	*filep;
181709Smckusick {
197765Smckusick 	if (filep->fblk >= MAXFILES || _actfile[filep->fblk] != filep ||
207765Smckusick 	    (filep->funit & FDEF)) {
213869Smckusic 		ERROR("Reference to an inactive file\n", 0);
221709Smckusick 		return;
231709Smckusick 	}
247765Smckusick 	if (filep->funit & FWRITE) {
257765Smckusick 		ERROR("%s: eoln is undefined on files open for writing\n",
267765Smckusick 		    filep->pfname);
277765Smckusick 		return;
287765Smckusick 	}
291709Smckusick 	IOSYNC(filep);
307765Smckusick 	if (filep->funit & EOFF) {
317765Smckusick 		ERROR("%s: eoln is undefined when eof is true\n",
327765Smckusick 		    filep->pfname);
337765Smckusick 		return;
347765Smckusick 	}
351709Smckusick 	if (filep->funit & EOLN)
361709Smckusick 		return TRUE;
371709Smckusick 	return FALSE;
381709Smckusick }
39