1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include "stddef.h" #include "sys/types.h" #include <unistd.h> #include "errno.h" #include "nonstd/syscall.h" int isatty(int fildes) { SCNO(scno, "isatty", 0); int r = __libc.syscall(scno, fildes); if (r < 0) { errno = -r; return 0; } return r; } /* POSIX(1) */