xref: /csrg-svn/usr.bin/pascal/libpc/PUT.c (revision 62094)
140865Sbostic /*-
2*62094Sbostic  * Copyright (c) 1979, 1993
3*62094Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71676Smckusick 
840865Sbostic #ifndef lint
9*62094Sbostic static char sccsid[] = "@(#)PUT.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111676Smckusick 
121676Smckusick #include "h00vars.h"
131676Smckusick 
PUT(curfile)141676Smckusick PUT(curfile)
151676Smckusick 
161676Smckusick 	register struct iorec	*curfile;
171676Smckusick {
181676Smckusick 	if (curfile->funit & FREAD) {
193868Smckusic 		ERROR("%s: Attempt to write, but open for reading\n",
203868Smckusic 			curfile->pfname);
211676Smckusick 		return;
221676Smckusick 	}
233017Smckusic 	fwrite(curfile->fileptr, (int)curfile->fsize, 1, curfile->fbuf);
241676Smckusick 	if (ferror(curfile->fbuf)) {
253868Smckusic 		PERROR("Could not write to ", curfile->pfname);
261676Smckusick 		return;
271676Smckusick 	}
281676Smckusick }
29