11679Smckusick /* Copyright (c) 1979 Regents of the University of California */ 21679Smckusick 3*3019Smckusic static char sccsid[] = "@(#)READ4.c 1.4 03/07/81"; 41679Smckusick 51679Smckusick #include "h00vars.h" 61679Smckusick #include "h01errs.h" 71679Smckusick 8*3019Smckusic long 91679Smckusick READ4(curfile) 101679Smckusick 111679Smckusick register struct iorec *curfile; 121679Smckusick { 13*3019Smckusic long data; 14*3019Smckusic int retval; 151679Smckusick 161679Smckusick if (curfile->funit & FWRITE) { 171679Smckusick ERROR(EREADIT, curfile->pfname); 181679Smckusick return; 191679Smckusick } 201679Smckusick UNSYNC(curfile); 212223Smckusic retval = fscanf(curfile->fbuf, "%ld", &data); 222223Smckusic if (retval == EOF) { 232223Smckusic ERROR(EPASTEOF, curfile->pfname); 242223Smckusic return; 252223Smckusic } 262223Smckusic if (retval == 0) { 271679Smckusick ERROR(EBADINUM, curfile->pfname); 281679Smckusick return; 291679Smckusick } 302309Smckusic curfile->funit &= ~EOLN; 311679Smckusick curfile->funit |= SYNC; 321679Smckusick return data; 331679Smckusick } 34