forget difference between big and small commands - obsolete with vm.
[minix.git] / commands / simple / tty.c
blob21abf37511df06c67213cc72eb9d5cd3b1cf97a2
1 /* tty.c - Return tty name Author: Freeman P. Pascal IV */
3 /* Minor changes to make tty conform to POSIX1003.2 Draft10
4 Thomas Brupbacher (tobr@mw.lpc.ethz.ch) */
6 #include <sys/types.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10 #include <stdio.h>
12 _PROTOTYPE(int main, (int argc, char **argv));
14 int main(argc, argv)
15 int argc;
16 char *argv[];
18 char *tty_name;
20 tty_name = ttyname(STDIN_FILENO);
21 if ((argc == 2) && (!strcmp(argv[1], "-s")))
22 /* Do nothing - shhh! we're in silent mode */ ;
23 else
24 puts((tty_name != NULL) ? tty_name : "not a tty");
26 if (isatty(STDIN_FILENO) == 0)
27 return(1);
28 else
29 return(0);