1: # include "ciodec.c"
   2: char cgetc(fn)
   3: {
   4: struct fileps *fp;
   5: if (nargs() != 1)
   6:     IEHzap("cgetc  ");
   7: if (fn <0 || fn >15)
   8:     IEH3err("cgetc: %d illegal file number",fn);
   9: fp = &IEH3fpts[fn];
  10: if (fp == 0 || fp->wrflag > 1)
  11:     IEH3err("cgetc: %d not open to read",fn);
  12: if (fp->wrflag == 0)
  13:     /* file not opened with fopen: try making a buffer */
  14:     IEH3mbuf (fn, 0);
  15: if (fp->eoferr > 1)
  16:     return ('\0');
  17: if (fp->nchars == 0)
  18:      switch (fp->nchars = read(fn, fp->bptr=fp->buff, fp->bsize))
  19:         {
  20:         case -1: /* error */
  21:             if (fp->eoferr == 0)
  22:                 IEH3err("cgetc: error on %d",fn);
  23:             fp->eoferr = 3;
  24:             return ('\0');
  25:         case 0: fp->eoferr = 2;
  26:             return ('\0');
  27:         }
  28: fp->nchars--;
  29: return (*(fp->bptr++));
  30: }
  31: cin 0;

Defined functions

cgetc defined in line 2; used 10 times

Defined variables

cin defined in line 31; never used
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 611
Valid CSS Valid XHTML 1.0 Strict