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