rationalrevolt
rationalrevolt

Reputation: 663

Is there a way to determine if STDIN is a TTY through a system call?

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

Answers (1)

user149341
user149341

Reputation:

isatty() works by trying to execute the TCGETS ioctl on a file descriptor. If it succeeds, it's a TTY.

Upvotes: 3

Related Questions