1: /*
   2: char id_getc[] = "@(#)getc_.c	1.3";
   3:  *
   4:  * get a character from the standard input
   5:  *
   6:  * calling sequence:
   7:  *	integer getc
   8:  *	ierror = getc (char)
   9:  * where:
  10:  *	char will be read from the standard input, usually the terminal
  11:  *	ierror will be 0 if successful; a system error code otherwise.
  12:  */
  13: 
  14: #include    "../libI77/fiodefs.h"
  15: 
  16: extern unit units[];    /* logical units table from iolib */
  17: 
  18: ftnint getc_(c, clen)
  19: char *c; ftnlen clen;
  20: {
  21:     int i;
  22:     unit    *lu;
  23: 
  24:     lu = &units[STDIN];
  25:     if (!lu->ufd)
  26:         return((ftnint)(errno=F_ERNOPEN));
  27:     if (lu->uwrt && ! nowreading(lu))
  28:         return((ftnint)errno);
  29:     if ((i = getc (lu->ufd)) < 0)
  30:     {
  31:         if (feof(lu->ufd))
  32:             return((ftnint) -1);
  33:         i = errno;
  34:         clearerr(lu->ufd);
  35:         return((ftnint)i);
  36:     }
  37:     *c = i & 0177;
  38:     return((ftnint) 0);
  39: }

Defined functions

getc_ defined in line 18; never used
Last modified: 1983-07-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 685
Valid CSS Valid XHTML 1.0 Strict