FENIX_coreutils/tty.c

16 lines
242 B
C
Executable file

#define _POSIX_C_SOURCE 200809L
#include <unistd.h>
#include <string.h>
#include <stdio.h>
int main() {
if(isatty(fileno(stdin))) {
printf("%s\n", ttyname(0));
return 0;
}
else {
printf("not a tty\n");
return 1;
}
}