micro-utils/coreutils/tty.c

14 lines
168 B
C
Raw Permalink Normal View History

#include <unistd.h>
#include <stdio.h>
int main(void) {
char *tty = ttyname(STDIN_FILENO);
if (tty)
puts(tty);
else
puts("not a tty");
return tty == NULL;
}