xref: /original-bsd/usr.bin/pascal/libpc/READC.c (revision 792e4f5f)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)READC.c 1.3 01/09/89";
4 
5 #include "h00vars.h"
6 
7 char
8 READC(curfile)
9 
10 	register struct iorec	*curfile;
11 {
12 	char			data;
13 
14 	if (curfile->funit & FWRITE) {
15 		ERROR("%s: Attempt to read, but open for writing\n",
16 			curfile->pfname);
17 	}
18 	IOSYNC(curfile);
19 	if (curfile->funit & EOFF) {
20 		ERROR("%s: Tried to read past end of file\n", curfile->pfname);
21 	}
22 	curfile->funit |= SYNC;
23 	return *curfile->fileptr;
24 }
25