xref: /csrg-svn/usr.bin/pascal/libpc/PUT.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  */
71676Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)PUT.c	1.4 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111676Smckusick 
121676Smckusick #include "h00vars.h"
131676Smckusick 
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