xref: /csrg-svn/usr.bin/pascal/libpc/WRITES.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  */
71717Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)WRITES.c	1.5 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111717Smckusick 
121717Smckusick #include "h00vars.h"
131717Smckusick 
141717Smckusick WRITES(curfile, d1, d2, d3, d4)
151717Smckusick 
161717Smckusick 	register struct iorec	*curfile;
173041Smckusic 	FILE			*d1;
183169Smckusic 	int			d2, d3;
193041Smckusic 	char			*d4;
201717Smckusick {
211717Smckusick 	if (curfile->funit & FREAD) {
223869Smckusic 		ERROR("%s: Attempt to write, but open for reading\n",
233869Smckusic 			curfile->pfname);
241717Smckusick 		return;
251717Smckusick 	}
263169Smckusic 	fwrite(d1, d2, d3, d4);
271717Smckusick 	if (ferror(curfile->fbuf)) {
283869Smckusic 		PERROR("Could not write to ", curfile->pfname);
291717Smckusick 		return;
301717Smckusick 	}
311717Smckusick }
32