xref: /csrg-svn/usr.bin/pascal/libpc/READC.c (revision 3869)
11681Smckusick /* Copyright (c) 1979 Regents of the University of California */
21681Smckusick 
3*3869Smckusic static char sccsid[] = "@(#)READC.c 1.2 06/10/81";
41681Smckusick 
51681Smckusick #include "h00vars.h"
61681Smckusick 
71681Smckusick char
81681Smckusick READC(curfile)
91681Smckusick 
101681Smckusick 	register struct iorec	*curfile;
111681Smckusick {
121681Smckusick 	char			data;
131681Smckusick 
141681Smckusick 	if (curfile->funit & FWRITE) {
15*3869Smckusic 		ERROR("%s: Attempt to read, but open for writing\n",
16*3869Smckusic 			curfile->pfname);
171681Smckusick 		return;
181681Smckusick 	}
191681Smckusick 	IOSYNC(curfile);
201681Smckusick 	if (curfile->funit & EOFF) {
21*3869Smckusic 		ERROR("%s: Tried to read past end of file\n", curfile->pfname);
221681Smckusick 		return;
231681Smckusick 	}
241681Smckusick 	curfile->funit |= SYNC;
251681Smckusick 	return *curfile->fileptr;
261681Smckusick }
27