1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)fgetc_.c	5.1	6/7/85
   7:  */
   8: 
   9: /*
  10:  * get a character from a logical unit bypassing formatted I/O
  11:  *
  12:  * calling sequence:
  13:  *	integer fgetc
  14:  *	ierror = fgetc (unit, char)
  15:  * where:
  16:  *	char will return a character from logical unit
  17:  *	ierror will be 0 if successful; a system error code otherwise.
  18:  */
  19: 
  20: #include    "../libI77/fiodefs.h"
  21: #include    "../libI77/f_errno.h"
  22: 
  23: extern unit units[];    /* logical units table from iolib */
  24: 
  25: long fgetc_(u, c, clen)
  26: long *u; char *c; long clen;
  27: {
  28:     int i;
  29:     unit    *lu;
  30: 
  31:     if (*u < 0 || *u >= MXUNIT)
  32:         return((long)(errno=F_ERUNIT));
  33:     lu = &units[*u];
  34:     if (!lu->ufd)
  35:         return((long)(errno=F_ERNOPEN));
  36:     if (lu->uwrt && ! nowreading(lu))
  37:         return((long)errno);
  38:     if ((i = getc (lu->ufd)) < 0)
  39:     {
  40:         if (feof(lu->ufd))
  41:             return(-1L);
  42:         i = errno;
  43:         clearerr(lu->ufd);
  44:         return((long)i);
  45:     }
  46:     *c = i;
  47:     return(0L);
  48: }

Defined functions

fgetc_ defined in line 25; never used
Last modified: 1987-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 749
Valid CSS Valid XHTML 1.0 Strict