1 2 3 4 5 6 7 8 9 10 11
#include <sys/termio.h> int isatty(fd) int fd; { struct termio buf; if (ioctl (fd, TCGETA, &buf) == -1) return 0; return 1; }