Audit tty(1)

1) Be strict about number of arguments passed
2) Use a simpler logic while returning
This commit is contained in:
FRIGN 2015-02-28 19:59:34 +01:00
parent e45297a320
commit b9b28d4039
2 changed files with 5 additions and 2 deletions

2
README
View File

@ -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

5
tty.c
View File

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