ack/plat/linux/libsys/isatty.c
George Koehler f6dc6f6875 Implement isatty() for Linux.
If it understands TIOCGETD, then it is a tty, else it isn't one.  This
seems to help Basic's input statement so I can see the prompt before
I enter my input.
2016-09-20 21:28:37 -04:00

13 lines
277 B
C

/*
* XXX - can't #include <sys/ioctl.h> because libcc.ansi and libsys
* both provide it, and we might find the wrong one.
*/
#define TIOCGETD 0x5424
int ioctl(int fd, unsigned long, ...);
int isatty(int fd)
{
int line_disc;
return 0 <= ioctl(fd, TIOCGETD, &line_disc);
}