Reputation: 663
I know there is the int isatty(int filedes)
function, but this in the standard C library. I want to determine if STDIN is a TTY by making a system call in Linux and OSX (I am writing a FORTH in assembly and I do not want to link to the C library).
Upvotes: 5
Views: 519
Reputation:
isatty()
works by trying to execute the TCGETS ioctl on a file descriptor. If it succeeds, it's a TTY.
Upvotes: 3