11679Smckusick /* Copyright (c) 1979 Regents of the University of California */ 21679Smckusick 3*2223Smckusic static char sccsid[] = "@(#)READ4.c 1.2 01/24/81"; 41679Smckusick 51679Smckusick #include "h00vars.h" 61679Smckusick #include "h01errs.h" 71679Smckusick 81679Smckusick READ4(curfile) 91679Smckusick 101679Smckusick register struct iorec *curfile; 111679Smckusick { 12*2223Smckusic int data, retval; 131679Smckusick 141679Smckusick if (curfile->funit & FWRITE) { 151679Smckusick ERROR(EREADIT, curfile->pfname); 161679Smckusick return; 171679Smckusick } 181679Smckusick UNSYNC(curfile); 19*2223Smckusic retval = fscanf(curfile->fbuf, "%ld", &data); 20*2223Smckusic if (retval == EOF) { 21*2223Smckusic ERROR(EPASTEOF, curfile->pfname); 22*2223Smckusic return; 23*2223Smckusic } 24*2223Smckusic if (retval == 0) { 251679Smckusick ERROR(EBADINUM, curfile->pfname); 261679Smckusick return; 271679Smckusick } 281679Smckusick curfile->funit |= SYNC; 291679Smckusick return data; 301679Smckusick } 31