[hackers] [sbase] Refactor tty(1) code and manpage || FRIGN
commit c2a4cd695e3132226c03dd63aa767bc15d0608c4
Author: FRIGN <dev_AT_frign.de>
Date: Sat Feb 7 22:00:28 2015 +0100
Refactor tty(1) code and manpage
diff --git a/README b/README
index 1c9adcb..01dccf7 100644
--- a/README
+++ b/README
_AT_@ -71,7 +71,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
= touch no -r
#* tr yes none
=* true yes none
-= tty yes none
+=* tty yes none
= uname yes none
# unexpand yes none
= uniq no -f, -s
diff --git a/tty.1 b/tty.1
index 2bdca93..8fd58d8 100644
--- a/tty.1
+++ b/tty.1
_AT_@ -1,4 +1,4 @@
-.Dd January 30, 2015
+.Dd February 7, 2015
.Dt TTY 1
.Os sbase
.Sh NAME
_AT_@ -8,9 +8,21 @@
.Nm
.Sh DESCRIPTION
.Nm
-prints the name of the terminal open on stdin.
-.Pp
-The status code is 0 if stdin is a terminal, and 1 if not. If an error occurred
-the status code is 2.
+writes the name of the terminal open on stdin to stdout.
+.Sh EXIT STATUS
+.Bl -tag -width Ds
+.It 0
+stdin is a terminal.
+.It 1
+stdin is not a terminal.
+.It > 1
+An error occurred.
+.El
.Sh SEE ALSO
.Xr ttyname 3
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
diff --git a/tty.c b/tty.c
index 1682e73..acfec01 100644
--- a/tty.c
+++ b/tty.c
_AT_@ -1,6 +1,5 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
-#include <stdlib.h>
#include <unistd.h>
#include "util.h"
_AT_@ -23,5 +22,6 @@ main(int argc, char *argv[])
tty = ttyname(STDIN_FILENO);
puts(tty ? tty : "not a tty");
+
return tty ? 0 : 1;
}
Received on Sat Feb 07 2015 - 22:54:33 CET
This archive was generated by hypermail 2.3.0
: Sat Feb 07 2015 - 23:00:16 CET