[hackers] [sbase] Audit tty(1) || FRIGN

From: <git_AT_suckless.org>
Date: Sat, 28 Feb 2015 20:40:39 +0100 (CET)

commit 8741f98bb0ea9eea189daaac33aa491e2adac57e
Author: FRIGN <dev_AT_frign.de>
Date: Sat Feb 28 19:59:34 2015 +0100

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

diff --git a/README b/README
index 9833019..5edba2e 100644
--- a/README
+++ b/README
_AT_@ -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
index acfec01..1c23bf4 100644
--- a/tty.c
+++ b/tty.c
_AT_@ -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;
 }
Received on Sat Feb 28 2015 - 20:40:39 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 28 2015 - 20:48:12 CET