xref: /original-bsd/usr.bin/pascal/libpc/REWRITE.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1979, 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[] = "@(#)REWRITE.c	8.1 (Berkeley) 06/06/93";
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