1: /* Copyright (c) 1979 Regents of the University of California */
   2: 
   3: static char sccsid[] = "@(#)READ4.c 1.8 10/28/83";
   4: 
   5: #include "h00vars.h"
   6: #include <errno.h>
   7: extern int errno;
   8: 
   9: long
  10: READ4(curfile)
  11: 
  12:     register struct iorec   *curfile;
  13: {
  14:     long            data;
  15:     int         retval;
  16: 
  17:     if (curfile->funit & FWRITE) {
  18:         ERROR("%s: Attempt to read, but open for writing\n",
  19:             curfile->pfname);
  20:         return;
  21:     }
  22:     UNSYNC(curfile);
  23:     errno = 0;
  24:     retval = fscanf(curfile->fbuf, "%ld", &data);
  25:     if (retval == EOF) {
  26:         ERROR("%s: Tried to read past end of file\n", curfile->pfname);
  27:         return;
  28:     }
  29:     if (retval == 0) {
  30:         ERROR("%s: Bad data found on integer read\n", curfile->pfname);
  31:         return;
  32:     }
  33:     if (errno == ERANGE) {
  34:         ERROR("%s: Overflow on integer read\n", curfile->pfname);
  35:         return;
  36:     }
  37:     if (errno != 0) {
  38:         PERROR("Error encountered on integer read ", curfile->pfname);
  39:         return;
  40:     }
  41:     return data;
  42: }

Defined functions

READ4 defined in line 9; used 2 times

Defined variables

sccsid defined in line 3; never used
Last modified: 1983-10-29
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1047
Valid CSS Valid XHTML 1.0 Strict