xref: /csrg-svn/usr.bin/pascal/libpc/WRITEC.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  */
71715Smckusick 
840865Sbostic #ifndef lint
9*62096Sbostic static char sccsid[] = "@(#)WRITEC.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111715Smckusick 
121715Smckusick #include "h00vars.h"
131715Smckusick 
WRITEC(curfile,d1,d2)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