don't strip parity since its done with stdio.
[unix-history] / usr / src / usr.bin / f77 / libU77 / getc_.c
CommitLineData
30723849 1/*
3c473027 2char id_getc[] = "@(#)getc_.c 1.4";
30723849
DW
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{
338a6799
DW
22 int i;
23 unit *lu;
30723849 24
338a6799
DW
25 lu = &units[STDIN];
26 if (!lu->ufd)
30723849 27 return((long)(errno=F_ERNOPEN));
337a7375
DW
28 if (lu->uwrt && ! nowreading(lu))
29 return((long)errno);
338a6799 30 if ((i = getc (lu->ufd)) < 0)
30723849 31 {
338a6799 32 if (feof(lu->ufd))
30723849
DW
33 return(-1L);
34 i = errno;
338a6799 35 clearerr(lu->ufd);
30723849
DW
36 return((long)i);
37 }
3c473027 38 *c = i;
30723849
DW
39 return(0L);
40}