xref: /csrg-svn/usr.bin/pascal/libpc/REWRITE.c (revision 62096)
140865Sbostic /*-
2*62096Sbostic  * Copyright (c) 1979, 1993
3*62096Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71696Smckusick 
840865Sbostic #ifndef lint
9*62096Sbostic static char sccsid[] = "@(#)REWRITE.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111696Smckusick 
121696Smckusick #include "h00vars.h"
131696Smckusick 
REWRITE(filep,name,maxnamlen,datasize)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