svn commit: r304220 - head/usr.bin/tty
Sofian Brabez
sbz at FreeBSD.org
Tue Aug 16 14:15:10 UTC 2016
Author: sbz (ports committer)
Date: Tue Aug 16 14:15:09 2016
New Revision: 304220
URL: https://svnweb.freebsd.org/changeset/base/304220
Log:
tty: Use proper definition of exit status code and stdin macro
Reviewed by: bapt, bdrewery
Differential Revision: https://reviews.freebsd.org/D6828
Modified:
head/usr.bin/tty/tty.c
Modified: head/usr.bin/tty/tty.c
==============================================================================
--- head/usr.bin/tty/tty.c Tue Aug 16 13:08:03 2016 (r304219)
+++ head/usr.bin/tty/tty.c Tue Aug 16 14:15:09 2016 (r304220)
@@ -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);
}
More information about the svn-src-head
mailing list