xref: /csrg-svn/usr.bin/pascal/libpc/GET.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  */
71655Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)GET.c	1.3 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111655Smckusick 
121655Smckusick #include "h00vars.h"
131655Smckusick 
141655Smckusick GET(curfile)
151655Smckusick 
161655Smckusick 	register struct iorec	*curfile;
171655Smckusick {
181655Smckusick 	if (curfile->funit & FWRITE) {
193867Smckusic 		ERROR("%s: Attempt to read, but open for writing\n",
203867Smckusic 			curfile->pfname);
211655Smckusick 		return;
221655Smckusick 	}
231655Smckusick 	IOSYNC(curfile);
241655Smckusick 	if (curfile->funit & EOFF) {
253867Smckusic 		ERROR("%s: Tried to read past end of file\n", curfile->pfname);
261655Smckusick 		return;
271655Smckusick 	}
281655Smckusick 	curfile->funit |= SYNC;
291655Smckusick }
30