xref: /original-bsd/usr.bin/pascal/libpc/VWRITEF.c (revision 5000927f)
1 /*-
2  * Copyright (c) 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)VWRITEF.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include "h00vars.h"
13 
14 #include <stdarg.h>
15 
16 VWRITEF(curfile, file, format, args)
17 
18 	register struct iorec	*curfile;
19 	FILE			*file;
20 	char 			*format;
21 	va_list			args;
22 {
23 
24 	if (curfile->funit & FREAD) {
25 		ERROR("%s: Attempt to write, but open for reading\n",
26 			curfile->pfname);
27 		return;
28 	}
29 	vfprintf(file, format, args);
30 	if (ferror(curfile->fbuf)) {
31 		PERROR("Could not write to ", curfile->pfname);
32 		return;
33 	}
34 }
35