From 34e4bfb5313fa32e36ff208335cef34942ed142b Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 6 Mar 2022 01:45:14 -0600 Subject: [PATCH] Minor tweaks. --- toys/posix/tty.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/toys/posix/tty.c b/toys/posix/tty.c index 9a833d5e..6116f135 100644 --- a/toys/posix/tty.c +++ b/toys/posix/tty.c @@ -12,10 +12,8 @@ config TTY help usage: tty [-s] - Show filename of terminal connected to stdin. - - Prints "not a tty" and exits with nonzero status if no terminal - is connected to stdin. + Show filename of terminal connected to stdin. If none print "not a tty" + and exit with nonzero status. -s Silent, exit code only */ @@ -26,7 +24,6 @@ void tty_main(void) { char *tty = ttyname(0); - if (!toys.optflags) puts(tty ? tty : "not a tty"); - toys.exitval = !tty; + if (!toys.optflags) puts(tty ? : "not a tty"); } -- 2.39.2