xref: /original-bsd/usr.bin/pascal/libpc/REWRITE.c (revision 1e7fda44)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)REWRITE.c 1.3 06/10/81";
4 
5 #include "h00vars.h"
6 
7 REWRITE(filep, name, maxnamlen, datasize)
8 
9 	register struct iorec	*filep;
10 	char			*name;
11 	long			maxnamlen;
12 	long			datasize;
13 {
14 	filep = GETNAME (filep, name, maxnamlen, datasize);
15 	filep->fbuf = fopen(filep->fname, "w");
16 	if (filep->fbuf == NULL) {
17 		PERROR("Could not create ",filep->pfname);
18 		return;
19 	}
20 	filep->funit |= (EOFF | FWRITE);
21 	if (filep->fblk > PREDEF) {
22 		setbuf(filep->fbuf, &filep->buf[0]);
23 	}
24 }
25