summaryrefslogtreecommitdiffstats
path: root/usr.bin/tput
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-06-14 15:08:05 +0000
committertjr <tjr@FreeBSD.org>2002-06-14 15:08:05 +0000
commit99e93d002e31d41a29f565c490fc7c5078dce765 (patch)
tree1fafc1c143278cc30bd0a793d3fe0d601c30ce68 /usr.bin/tput
parentf8e6c7f29294711d9585f3005ea34e5d0c6b988f (diff)
downloadFreeBSD-src-99e93d002e31d41a29f565c490fc7c5078dce765.zip
FreeBSD-src-99e93d002e31d41a29f565c490fc7c5078dce765.tar.gz
Adjust the exit status to conform to SUSv3 and document the fact it takes
multiple `argument' operands.
Diffstat (limited to 'usr.bin/tput')
-rw-r--r--usr.bin/tput/tput.144
-rw-r--r--usr.bin/tput/tput.c4
2 files changed, 29 insertions, 19 deletions
diff --git a/usr.bin/tput/tput.1 b/usr.bin/tput/tput.1
index d8b1bc6..535b602 100644
--- a/usr.bin/tput/tput.1
+++ b/usr.bin/tput/tput.1
@@ -32,7 +32,7 @@
.\" @(#)tput.1 8.2 (Berkeley) 3/19/94
.\" $FreeBSD$
.\"
-.Dd March 19, 1994
+.Dd June 15, 2002
.Dt TPUT 1
.Os
.Sh NAME
@@ -42,7 +42,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl T Ar term
-.Ar attribute
+.Ar attribute ...
.Nm clear
.Sh DESCRIPTION
The
@@ -73,15 +73,15 @@ variable from the environment.
.Pp
The
.Nm
-command outputs a string if the
+command outputs a string for each
.Ar attribute
-is of type string; a number if it is of type integer.
+that is of type string; a number for each of type integer.
Otherwise,
.Nm
exits 0 if the terminal has the capability and 1 if it does not,
without further action.
.Pp
-If the
+If an
.Ar attribute
is of type string, and takes arguments (e.g. cursor movement,
the termcap
@@ -110,19 +110,24 @@ Reset the terminal (the
sequence).
.El
.Sh DIAGNOSTICS
-The exit value of
-.Nm
-is based on the last attribute specified.
-If the attribute is of type string or of type integer,
-.Nm
-exits 0 if the attribute is defined for this terminal type and 1
-if it is not.
-If the attribute is of type boolean,
-.Nm
-exits 0 if the terminal has this attribute, and 1 if it does not.
-The
+The exit status of
.Nm
-command exits 2 if any error occurred.
+is as follows:
+.Bl -tag -width indent
+.It 0
+If the last attribute
+.Ar attribute
+argument is of type string or integer, its value was successfully written
+to standard output.
+If the argument is of type boolean, the terminal has this attribute.
+.It 1
+This terminal does not have the specified boolean
+.Ar attribute .
+.It 2
+Usage error.
+.It 3
+No information is available about the specified terminal type.
+.El
.Sh SEE ALSO
.Xr termcap 5 ,
.Xr terminfo 5
@@ -138,6 +143,11 @@ in them that is just a
and nothing more. Right now we just warn about them if they don't
have a valid type declaration. These warnings are sent to
stderr.
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -p1003.1-2001 .
.Sh HISTORY
The
.Nm
diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c
index 522a540..99bb903 100644
--- a/usr.bin/tput/tput.c
+++ b/usr.bin/tput/tput.c
@@ -86,7 +86,7 @@ main(argc, argv)
if (!term && !(term = getenv("TERM")))
errx(2, "no terminal type specified and no TERM environmental variable.");
if (tgetent(tbuf, term) != 1)
- err(2, "tgetent failure");
+ err(3, "tgetent failure");
for (exitval = 0; (p = *argv) != NULL; ++argv) {
switch (*p) {
case 'c':
@@ -214,5 +214,5 @@ static void
usage()
{
(void)fprintf(stderr, "usage: tput [-T term] attribute ...\n");
- exit(1);
+ exit(2);
}
OpenPOWER on IntegriCloud