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