tty: Use proper definition of exit status code and stdin macro

Reviewed by:	bapt, bdrewery
Differential Revision:	https://reviews.freebsd.org/D6828
This commit is contained in:
sbz 2016-08-16 14:15:09 +00:00
parent 30758bfe03
commit 2f07869625

View File

@ -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);
}