1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)isatty_.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 /* 13 * determine if stream is associated with a tty (async port) 14 * 15 * calling sequence: 16 * logical isatty, val 17 * val = isatty (lunit) 18 * where: 19 * val will be .TRUE. if lunit is associated with a 'tty' 20 */ 21 22 #include "../libI77/fiodefs.h" 23 24 extern unit units[]; /* logical units table from iolib */ 25 26 long isatty_(u) 27 long *u; 28 { 29 int i; 30 unit *lu; 31 32 if (*u < 0 || *u >= MXUNIT) 33 return(0); 34 lu = &units[*u]; 35 if (!lu->ufd) 36 return(0); 37 return((long)(isatty(fileno(lu->ufd)) != 0)); 38 } 39