diff options
author | Sofian Brabez <sbz@FreeBSD.org> | 2016-08-16 14:15:09 +0000 |
---|---|---|
committer | Sofian Brabez <sbz@FreeBSD.org> | 2016-08-16 14:15:09 +0000 |
commit | 80a29058832fc0077e285b748cf89c7a186bd8e1 (patch) | |
tree | b09c630aeb3c8041d4da30c81358b6bfc3c33835 /usr.bin/tty | |
parent | 0fa047b98c07b0e555ac3b0c2898de82abb44a0a (diff) | |
download | src-test-80a29058832fc0077e285b748cf89c7a186bd8e1.tar.gz src-test-80a29058832fc0077e285b748cf89c7a186bd8e1.zip |
tty: Use proper definition of exit status code and stdin macro
Reviewed by: bapt, bdrewery
Differential Revision: https://reviews.freebsd.org/D6828
Notes
Notes:
svn path=/head/; revision=304220
Diffstat (limited to 'usr.bin/tty')
-rw-r--r-- | usr.bin/tty/tty.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tty/tty.c b/usr.bin/tty/tty.c index 450722a669844..fac74d034b5d9 100644 --- a/usr.bin/tty/tty.c +++ b/usr.bin/tty/tty.c @@ -63,17 +63,18 @@ main(int argc, char *argv[]) case '?': default: usage(); + /* NOTREACHED */ } - t = ttyname(0); + t = ttyname(STDIN_FILENO); if (!sflag) puts(t ? t : "not a tty"); - exit(t ? 0 : 1); + exit(t ? EXIT_SUCCESS : EXIT_FAILURE); } static void usage(void) { - fprintf(stderr, "usage: tty [-s]\n"); + fprintf(stderr, "usage: %s [-s]\n", getprogname()); exit(2); } |