set EOF on null read at end of file. DLW
[unix-history] / usr / src / usr.bin / f77 / libU77 / isatty_.c
CommitLineData
d8cff725
DW
1/*
2char id_isatty[] = "@(#)isatty_.c 1.1";
3 *
4 * determine if stream is associated with a tty (async port)
5 *
6 * calling sequence:
7 * logical isatty, val
8 * val = isatty (lunit)
9 * where:
10 * val will be .TRUE. if lunit is associated with a 'tty'
11 */
12
13#include "../libI77/fiodefs.h"
14
15extern unit units[]; /* logical units table from iolib */
16
17long isatty_(u)
18long *u;
19{
20 int i;
21 unit *lu;
22
23 if (*u < 0 || *u >= MXUNIT)
24 return(0);
25 lu = &units[*u];
26 if (!lu->ufd)
27 return(0);
28 return((long)(isatty(fileno(lu->ufd)) != 0));
29}