sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit b9b28d40392c93ba81fc7143cdb9bd6a7a5d3729
parent e45297a320046cd9ad042b8fc30f188cd25921dd
Author: FRIGN <dev@frign.de>
Date:   Sat, 28 Feb 2015 19:59:34 +0100

Audit tty(1)

1) Be strict about number of arguments passed
2) Use a simpler logic while returning

Diffstat:
MREADME | 2+-
Mtty.c | 5++++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/README b/README @@ -78,7 +78,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* touch yes none #* tr yes none =*| true yes none -=* tty yes none +=*| tty yes none =* uname yes none #* unexpand yes none =* uniq yes none diff --git a/tty.c b/tty.c @@ -20,8 +20,11 @@ main(int argc, char *argv[]) usage(); } ARGEND; + if (argc) + usage(); + tty = ttyname(STDIN_FILENO); puts(tty ? tty : "not a tty"); - return tty ? 0 : 1; + return !tty; }