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: * @(#)getc_.c 5.1 6/7/85
7: */
8:
9: /*
10: * get a character from the standard input
11: *
12: * calling sequence:
13: * integer getc
14: * ierror = getc (char)
15: * where:
16: * char will be read from the standard input, usually the terminal
17: * ierror will be 0 if successful; a system error code otherwise.
18: */
19:
20: #include "../libI77/f_errno.h"
21: #include "../libI77/fiodefs.h"
22:
23: extern unit units[]; /* logical units table from iolib */
24:
25: long getc_(c, clen)
26: char *c; long clen;
27: {
28: int i;
29: unit *lu;
30:
31: lu = &units[STDIN];
32: if (!lu->ufd)
33: return((long)(errno=F_ERNOPEN));
34: if (lu->uwrt && ! nowreading(lu))
35: return((long)errno);
36: if ((i = getc (lu->ufd)) < 0)
37: {
38: if (feof(lu->ufd))
39: return(-1L);
40: i = errno;
41: clearerr(lu->ufd);
42: return((long)i);
43: }
44: *c = i;
45: return(0L);
46: }
Defined functions
getc_
defined in line
25;
never used