xref: /csrg-svn/usr.bin/pascal/libpc/PUT.c (revision 3868)
11676Smckusick /* Copyright (c) 1979 Regents of the University of California */
21676Smckusick 
3*3868Smckusic static char sccsid[] = "@(#)PUT.c 1.3 06/10/81";
41676Smckusick 
51676Smckusick #include "h00vars.h"
61676Smckusick 
71676Smckusick PUT(curfile)
81676Smckusick 
91676Smckusick 	register struct iorec	*curfile;
101676Smckusick {
111676Smckusick 	if (curfile->funit & FREAD) {
12*3868Smckusic 		ERROR("%s: Attempt to write, but open for reading\n",
13*3868Smckusic 			curfile->pfname);
141676Smckusick 		return;
151676Smckusick 	}
163017Smckusic 	fwrite(curfile->fileptr, (int)curfile->fsize, 1, curfile->fbuf);
171676Smckusick 	if (ferror(curfile->fbuf)) {
18*3868Smckusic 		PERROR("Could not write to ", curfile->pfname);
191676Smckusick 		return;
201676Smckusick 	}
211676Smckusick }
22