xref: /csrg-svn/usr.bin/pascal/libpc/READC.c (revision 1681)
1*1681Smckusick /* Copyright (c) 1979 Regents of the University of California */
2*1681Smckusick 
3*1681Smckusick static char sccsid[] = "@(#)READC.c 1.1 10/30/80";
4*1681Smckusick 
5*1681Smckusick #include "h00vars.h"
6*1681Smckusick #include "h01errs.h"
7*1681Smckusick 
8*1681Smckusick char
9*1681Smckusick READC(curfile)
10*1681Smckusick 
11*1681Smckusick 	register struct iorec	*curfile;
12*1681Smckusick {
13*1681Smckusick 	char			data;
14*1681Smckusick 
15*1681Smckusick 	if (curfile->funit & FWRITE) {
16*1681Smckusick 		ERROR(EREADIT, curfile->pfname);
17*1681Smckusick 		return;
18*1681Smckusick 	}
19*1681Smckusick 	IOSYNC(curfile);
20*1681Smckusick 	if (curfile->funit & EOFF) {
21*1681Smckusick 		ERROR(EPASTEOF, curfile->pfname);
22*1681Smckusick 		return;
23*1681Smckusick 	}
24*1681Smckusick 	curfile->funit |= SYNC;
25*1681Smckusick 	return *curfile->fileptr;
26*1681Smckusick }
27