xref: /original-bsd/usr.bin/pascal/libpc/REWRITE.c (revision b3f911e0)
1 /*-
2  * Copyright (c) 1979 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)REWRITE.c	1.4 (Berkeley) 04/09/90";
10 #endif /* not lint */
11 
12 #include "h00vars.h"
13 
14 REWRITE(filep, name, maxnamlen, datasize)
15 
16 	register struct iorec	*filep;
17 	char			*name;
18 	long			maxnamlen;
19 	long			datasize;
20 {
21 	filep = GETNAME (filep, name, maxnamlen, datasize);
22 	filep->fbuf = fopen(filep->fname, "w");
23 	if (filep->fbuf == NULL) {
24 		PERROR("Could not create ",filep->pfname);
25 		return;
26 	}
27 	filep->funit |= (EOFF | FWRITE);
28 	if (filep->fblk > PREDEF) {
29 		setbuf(filep->fbuf, &filep->buf[0]);
30 	}
31 }
32