1 2 3 4 5 6 7 8 9 10 11 12 13
#include "toys.h" int tty_main(void) { char *name = ttyname(0); if (!toys.optflags) { if (name) puts(name); else puts("Not a tty"); } return !name; }