// tty.c, version 1.1.0 // OMKOV coreutils implementation of POSIX tty // Copyright (C) 2020, Jakob Wakeling // MIT Licence #include #include int main(void) { char *tty = ttyname(fileno(stdin)); if (tty) { puts(tty); return 0; } else { printf("not a tty\n"); return 1; } }