xref: /csrg-svn/usr.bin/pascal/libpc/WRITEC.c (revision 40865)
1*40865Sbostic /*-
2*40865Sbostic  * Copyright (c) 1979 The Regents of the University of California.
3*40865Sbostic  * All rights reserved.
4*40865Sbostic  *
5*40865Sbostic  * %sccs.include.redist.c%
6*40865Sbostic  */
71715Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)WRITEC.c	1.5 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111715Smckusick 
121715Smckusick #include "h00vars.h"
131715Smckusick 
141715Smckusick WRITEC(curfile, d1, d2)
151715Smckusick 
161715Smckusick 	register struct iorec	*curfile;
173167Smckusic 	char			d1;
183039Smckusic 	FILE			*d2;
191715Smckusick {
201715Smckusick 	if (curfile->funit & FREAD) {
213869Smckusic 		ERROR("%s: Attempt to write, but open for reading\n",
223869Smckusic 			curfile->pfname);
231715Smckusick 		return;
241715Smckusick 	}
253167Smckusic 	fputc(d1, d2);
261715Smckusick 	if (ferror(curfile->fbuf)) {
273869Smckusic 		PERROR("Could not write to ", curfile->pfname);
281715Smckusick 		return;
291715Smckusick 	}
301715Smckusick }
31