11680Smckusick /* Copyright (c) 1979 Regents of the University of California */ 21680Smckusick 3*2223Smckusic static char sccsid[] = "@(#)READ8.c 1.2 01/24/81"; 41680Smckusick 51680Smckusick #include "h00vars.h" 61680Smckusick #include "h01errs.h" 71680Smckusick 81680Smckusick double 91680Smckusick READ8(curfile) 101680Smckusick 111680Smckusick register struct iorec *curfile; 121680Smckusick { 131680Smckusick double data; 14*2223Smckusic int retval; 151680Smckusick 161680Smckusick if (curfile->funit & FWRITE) { 171680Smckusick ERROR(EREADIT, curfile->pfname); 181680Smckusick return; 191680Smckusick } 201680Smckusick UNSYNC(curfile); 21*2223Smckusic retval = fscanf(curfile->fbuf, "%lf", &data); 22*2223Smckusic if (retval == EOF) { 23*2223Smckusic ERROR(EPASTEOF, curfile->pfname); 24*2223Smckusic return; 25*2223Smckusic } 26*2223Smckusic if (retval == 0) { 271680Smckusick ERROR(EBADFNUM, curfile->pfname); 281680Smckusick return; 291680Smckusick } 301680Smckusick curfile->funit |= SYNC; 311680Smckusick return data; 321680Smckusick } 33