xref: /freebsd-13-stable/usr.bin/tput/tput.1 (revision 24115b70d6d614ed7ac5cfc4f51fa9d6cfe8b1b2)
1.\" Copyright (c) 1989, 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)tput.1	8.2 (Berkeley) 3/19/94
29.\"
30.Dd June 15, 2002
31.Dt TPUT 1
32.Os
33.Sh NAME
34.Nm tput ,
35.Nm clear
36.Nd terminal capability interface
37.Sh SYNOPSIS
38.Nm
39.Op Fl T Ar term
40.Op Ar attribute ...
41.Nm clear
42.Sh DESCRIPTION
43The
44.Nm
45utility makes terminal-dependent information available to users or shell
46applications.
47.Pp
48The
49.Nm clear
50utility executes the
51.Dl tput clear
52command, ignoring any arguments.
53.Pp
54The only option to
55.Nm
56is:
57.Bl -tag -width 2n
58.It Fl T
59The terminal name as specified in the
60.Xr termcap 5
61database, for example,
62.Dq vt100
63or
64.Dq xterm .
65If not specified,
66.Nm
67retrieves the
68.Dq Ev TERM
69variable from the environment unless that too is not specified,
70in which case an error message will be sent to standard error and
71the error status will be 2.
72.El
73.Pp
74The
75.Nm
76utility outputs a string for each
77.Ar attribute
78that is of type string; a number for each of type integer.
79Otherwise,
80.Nm
81exits 0 if the terminal has the capability and 1 if it does not,
82without further action.
83.Pp
84If an
85.Ar attribute
86is of type string, and takes arguments (e.g.\& cursor movement,
87the termcap
88.Dq cm
89capability) the arguments are taken from the command line immediately
90following the attribute.
91.Pp
92The following special attributes are available.
93The first three use the capabilities of the specified terminal,
94and only work if compatible with the utility's terminal.
95.Bl -tag -width Ar
96.It Cm clear
97Clear the screen (the
98.Xr termcap 5
99.Dq cl
100capability).
101.It Cm init
102Initialize the terminal (the
103.Xr termcap 5
104.Dq is
105capability).
106.It Cm reset
107Reset the terminal (the
108.Xr termcap 5
109.Dq rs
110capability).
111.It Cm longname
112Print the descriptive name of the user's terminal type.
113.El
114.Sh ENVIRONMENT
115.Bl -tag -width ".Ev TERM"
116.It Ev TERM
117The terminal name, if set and
118.Fl T
119is not used.
120.El
121.Sh EXIT STATUS
122The exit status of
123.Nm
124is as follows:
125.Bl -tag -width indent
126.It 0
127If the last
128.Ar attribute
129is of type string or integer, its value was successfully written
130to standard output.
131If the
132.Ar attribute
133is of type boolean, the terminal does have the
134.Ar attribute .
135Otherwise, no
136.Ar attribute
137was specified.
138.It 1
139If the last
140.Ar attribute
141is of type boolean,
142this terminal does not have the
143.Ar attribute .
144.It 2
145Usage error.
146For example, see
147.Fl T
148description.
149.It 3
150No information is available about the specified terminal type.
151.El
152.Sh SEE ALSO
153.Xr termcap 5 ,
154.Xr terminfo 5
155.Sh STANDARDS
156The
157.Nm
158utility conforms to
159.St -p1003.1-2001 .
160.Sh HISTORY
161The
162.Nm
163utility appeared in
164.Bx 4.4 .
165.Sh BUGS
166The
167.Nm
168utility cannot really distinguish between different types of attributes.
169.Pp
170Some termcap entries depend upon having a
171.Sq %
172in them that is just a
173.Sq %
174and nothing more.
175Right now we just warn about them if they do not
176have a valid type declaration.
177These warnings are sent to
178stderr.
179