xref: /original-bsd/usr.bin/pascal/libpc/WRITEC.c (revision 18f6d767)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)WRITEC.c 1.4 06/10/81";
4 
5 #include "h00vars.h"
6 
7 WRITEC(curfile, d1, d2)
8 
9 	register struct iorec	*curfile;
10 	char			d1;
11 	FILE			*d2;
12 {
13 	if (curfile->funit & FREAD) {
14 		ERROR("%s: Attempt to write, but open for reading\n",
15 			curfile->pfname);
16 		return;
17 	}
18 	fputc(d1, d2);
19 	if (ferror(curfile->fbuf)) {
20 		PERROR("Could not write to ", curfile->pfname);
21 		return;
22 	}
23 }
24