Commit | Line | Data |
---|---|---|
82492b51 KB |
1 | /*- |
2 | * Copyright (c) 1980 The Regents of the University of California. | |
3 | * All rights reserved. | |
d8cff725 | 4 | * |
ad787160 C |
5 | * This module is believed to contain source code proprietary to AT&T. |
6 | * Use and redistribution is subject to the Berkeley Software License | |
7 | * Agreement and your Software Agreement with AT&T (Western Electric). | |
161423a6 RE |
8 | */ |
9 | ||
82492b51 | 10 | #ifndef lint |
ad787160 | 11 | static char sccsid[] = "@(#)isatty_.c 5.2 (Berkeley) 4/12/91"; |
82492b51 KB |
12 | #endif /* not lint */ |
13 | ||
161423a6 | 14 | /* |
d8cff725 DW |
15 | * determine if stream is associated with a tty (async port) |
16 | * | |
17 | * calling sequence: | |
18 | * logical isatty, val | |
19 | * val = isatty (lunit) | |
20 | * where: | |
21 | * val will be .TRUE. if lunit is associated with a 'tty' | |
22 | */ | |
23 | ||
24 | #include "../libI77/fiodefs.h" | |
25 | ||
26 | extern unit units[]; /* logical units table from iolib */ | |
27 | ||
28 | long isatty_(u) | |
29 | long *u; | |
30 | { | |
31 | int i; | |
32 | unit *lu; | |
33 | ||
34 | if (*u < 0 || *u >= MXUNIT) | |
35 | return(0); | |
36 | lu = &units[*u]; | |
37 | if (!lu->ufd) | |
38 | return(0); | |
39 | return((long)(isatty(fileno(lu->ufd)) != 0)); | |
40 | } |