xref: /csrg-svn/usr.bin/pascal/libpc/REWRITE.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  */
71696Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)REWRITE.c	1.4 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111696Smckusick 
121696Smckusick #include "h00vars.h"
131696Smckusick 
141696Smckusick REWRITE(filep, name, maxnamlen, datasize)
151696Smckusick 
161696Smckusick 	register struct iorec	*filep;
171696Smckusick 	char			*name;
183027Smckusic 	long			maxnamlen;
193027Smckusic 	long			datasize;
201696Smckusick {
211696Smckusick 	filep = GETNAME (filep, name, maxnamlen, datasize);
221696Smckusick 	filep->fbuf = fopen(filep->fname, "w");
231696Smckusick 	if (filep->fbuf == NULL) {
243869Smckusic 		PERROR("Could not create ",filep->pfname);
251696Smckusick 		return;
261696Smckusick 	}
271696Smckusick 	filep->funit |= (EOFF | FWRITE);
281696Smckusick 	if (filep->fblk > PREDEF) {
291696Smckusick 		setbuf(filep->fbuf, &filep->buf[0]);
301696Smckusick 	}
311696Smckusick }
32