1 /* 2 char 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 15 extern unit units[]; /* logical units table from iolib */ 16 17 long isatty_(u) 18 long *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 } 30