2 * Copyright 2001-2013 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Daniel Reinhold, danielre@users.sf.net
19 printf("Usage: tty [-s]\n"
20 "Prints the file name for the terminal connected to standard input.\n"
21 " -s silent mode: no output -- only return an exit status\n");
28 main(int argc
, char *argv
[])
38 if (!strcmp(argv
[1], "-s"))
45 printf("%s\n", ttyname(STDIN_FILENO
));
48 return (isatty(STDIN_FILENO
) ? 0 : 1);