don't strip parity since its done with stdio.
[unix-history] / usr / src / usr.bin / f77 / libU77 / getc_.c
... / ...
CommitLineData
1/*
2char id_getc[] = "@(#)getc_.c 1.4";
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/f_errno.h"
15#include "../libI77/fiodefs.h"
16
17extern unit units[]; /* logical units table from iolib */
18
19long getc_(c, clen)
20char *c; long clen;
21{
22 int i;
23 unit *lu;
24
25 lu = &units[STDIN];
26 if (!lu->ufd)
27 return((long)(errno=F_ERNOPEN));
28 if (lu->uwrt && ! nowreading(lu))
29 return((long)errno);
30 if ((i = getc (lu->ufd)) < 0)
31 {
32 if (feof(lu->ufd))
33 return(-1L);
34 i = errno;
35 clearerr(lu->ufd);
36 return((long)i);
37 }
38 *c = i;
39 return(0L);
40}