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: ftnint isatty_(u) 18: ftnint *u; 19: { 20: unit *lu; 21: 22: if (*u < 0 || *u >= MXUNIT) 23: return((ftnint) 0); 24: lu = &units[*u]; 25: if (!lu->ufd) 26: return((ftnint) 0); 27: return((ftnint)(isatty(fileno(lu->ufd)) != 0)); 28: }