xref: /csrg-svn/usr.bin/pascal/libpc/READC.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  */
71681Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)READC.c	1.4 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111681Smckusick 
121681Smckusick #include "h00vars.h"
131681Smckusick 
141681Smckusick char
151681Smckusick READC(curfile)
161681Smckusick 
171681Smckusick 	register struct iorec	*curfile;
181681Smckusick {
191681Smckusick 	char			data;
201681Smckusick 
211681Smckusick 	if (curfile->funit & FWRITE) {
223869Smckusic 		ERROR("%s: Attempt to read, but open for writing\n",
233869Smckusic 			curfile->pfname);
241681Smckusick 	}
251681Smckusick 	IOSYNC(curfile);
261681Smckusick 	if (curfile->funit & EOFF) {
273869Smckusic 		ERROR("%s: Tried to read past end of file\n", curfile->pfname);
281681Smckusick 	}
291681Smckusick 	curfile->funit |= SYNC;
301681Smckusick 	return *curfile->fileptr;
311681Smckusick }
32