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