xref: /csrg-svn/usr.bin/pascal/libpc/READC.c (revision 62096)
140865Sbostic /*-
2*62096Sbostic  * Copyright (c) 1979, 1993
3*62096Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71681Smckusick 
840865Sbostic #ifndef lint
9*62096Sbostic static char sccsid[] = "@(#)READC.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111681Smckusick 
121681Smckusick #include "h00vars.h"
131681Smckusick 
141681Smckusick char
READC(curfile)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