1 /* @(#)isatty.c 4.2 (Berkeley) 05/16/84 */ 2 /* 3 * Returns 1 iff file is a tty 4 */ 5 6 #include <sgtty.h> 7 8 isatty(f) 9 { 10 struct sgttyb ttyb; 11 12 if (ioctl(f, TIOCGETP, &ttyb) < 0) 13 return(0); 14 return(1); 15 } 16