11718Smckusick /* Copyright (c) 1979 Regents of the University of California */
21718Smckusick 
3*3869Smckusic static char sccsid[] = "@(#)WRITLN.c 1.2 06/10/81";
41718Smckusick 
51718Smckusick #include "h00vars.h"
61718Smckusick 
71718Smckusick WRITLN(curfile)
81718Smckusick 
91718Smckusick 	register struct iorec	*curfile;
101718Smckusick {
111718Smckusick 	if (curfile->funit & FREAD) {
12*3869Smckusic 		ERROR("%s: Attempt to write, but open for reading\n",
13*3869Smckusic 			curfile->pfname);
141718Smckusick 		return;
151718Smckusick 	}
161718Smckusick 	if (++curfile->lcount >= curfile->llimit) {
17*3869Smckusic 		ERROR("%s: Line limit exceeded\n", curfile->pfname);
181718Smckusick 		return;
191718Smckusick 	}
201718Smckusick 	fputc('\n', curfile->fbuf);
211718Smckusick 	if (ferror(curfile->fbuf)) {
22*3869Smckusic 		PERROR("Could not write to ", curfile->pfname);
231718Smckusick 		return;
241718Smckusick 	}
251718Smckusick }
26