blob: eac87e116f4eb5588cfe7d603b62b8dcb6b1fdb7 [file] [log] [blame]
/*
* isatty.c
*/
#include <unistd.h>
#include <termios.h>
#include <errno.h>
int isatty(int fd)
{
int old_errno = errno;
int istty;
pid_t dummy;
/* All ttys support TIOCGPGRP */
istty = !ioctl(fd, TIOCGPGRP, &dummy);
errno = old_errno;
return istty;
}