xref: /csrg-svn/usr.bin/pascal/libpc/WRITLN.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  */
71718Smckusick 
840865Sbostic #ifndef lint
9*62096Sbostic static char sccsid[] = "@(#)WRITLN.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111718Smckusick 
121718Smckusick #include "h00vars.h"
131718Smckusick 
WRITLN(curfile)141718Smckusick WRITLN(curfile)
151718Smckusick 
161718Smckusick 	register struct iorec	*curfile;
171718Smckusick {
181718Smckusick 	if (curfile->funit & FREAD) {
193869Smckusic 		ERROR("%s: Attempt to write, but open for reading\n",
203869Smckusic 			curfile->pfname);
211718Smckusick 		return;
221718Smckusick 	}
231718Smckusick 	if (++curfile->lcount >= curfile->llimit) {
243869Smckusic 		ERROR("%s: Line limit exceeded\n", curfile->pfname);
251718Smckusick 		return;
261718Smckusick 	}
271718Smckusick 	fputc('\n', curfile->fbuf);
281718Smckusick 	if (ferror(curfile->fbuf)) {
293869Smckusic 		PERROR("Could not write to ", curfile->pfname);
301718Smckusick 		return;
311718Smckusick 	}
321718Smckusick }
33