unstack - fix ipcvecs
[minix.git] / commands / tty / tty.c
blobbf7bab6d812f2d441841d34e934be066cfa78acf
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 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);