xref: /openbsd/usr.bin/tput/tput.1 (revision 8932bfb7)
1.\"	$OpenBSD: tput.1,v 1.19 2010/09/29 07:44:56 jmc Exp $
2.\"	$NetBSD: tput.1,v 1.4 1994/12/07 08:49:10 jtc Exp $
3.\"
4.\" Copyright (c) 1989, 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)tput.1	8.2 (Berkeley) 3/19/94
32.\"
33.Dd $Mdocdate: September 29 2010 $
34.Dt TPUT 1
35.Os
36.Sh NAME
37.Nm tput
38.Nd terminal capability interface
39.Sh SYNOPSIS
40.Nm tput
41.Op Fl T Ar term
42.Ar attribute
43.Op Ar attribute-args
44.Ar ...
45.Nm tput
46.Op Fl T Ar term
47.Fl S
48.Sh DESCRIPTION
49The
50.Nm
51utility makes terminal-dependent information available to users or shell
52applications.
53.Pp
54The options are as follows:
55.Bl -tag -width Ds
56.It Fl S
57The attributes are read from stdin instead of the command line.
58.It Fl T
59The terminal name as found in the
60.Xr terminfo
61database; for example,
62.Dq vt100
63or
64.Dq xterm .
65If not specified,
66.Nm
67retrieves the
68.Ev TERM
69variable from the environment.
70.El
71.Pp
72.Nm
73outputs a string if the
74.Ar attribute
75is of type string or a number if it is of type integer.
76If the
77.Ar attribute
78is of type boolean,
79.Nm
80exits 0 if the terminal has the capability or 1 if it
81does not.
82Each
83.Ar attribute
84should be a string defined in either
85.Xr terminfo 5
86or
87.Xr termcap 5 .
88.Pp
89If the
90.Ar attribute
91is of type string and takes arguments (e.g., cursor movement,
92the
93.Xr terminfo
94.Dq cup
95sequence) the arguments are taken from the command line immediately
96following the attribute.
97.Pp
98The following special attributes are available:
99.Bl -tag -width Ar
100.It clear
101Clear the screen (the
102.Xr terminfo
103.Dq clear
104sequence).
105.It init
106Print the
107.Xr terminfo
108initialization strings for the specified terminal.
109.It longname
110Print the descriptive name of the user's terminal type.
111.It reset
112Reset the terminal (using the
113.Xr terminfo
114reset sequences).
115.El
116.Sh EXIT STATUS
117The exit value of
118.Nm
119is based on the last attribute specified.
120If the attribute is of type string or of type integer the exit
121value is as follows:
122.Pp
123.Bl -tag -offset indent -width Ds -compact
124.It 0
125The requested string was written successfully.
126.It 2
127Usage error.
128.It 3
129Unknown terminal type.
130.It 4
131Unknown attribute name.
132.It >4
133An error occurred.
134.El
135.Pp
136If the attribute is of type boolean,
137.Nm
138exits with a value of 0 if the terminal has this attribute or
1391 if it does not.
140.Sh EXAMPLES
141.Bl -tag -width "tput cup 6 11 dch 6" -compact
142.It Li "tput clear cup 5 10"
143clear the screen and goto line 5 column 10
144.Pp
145.It Li "tput cup 6 11 dch 6"
146goto line 6 column 11 and delete 6 characters
147.El
148.Sh SEE ALSO
149.Xr terminfo 3 ,
150.Xr terminfo 5
151.Sh STANDARDS
152The
153.Nm
154utility is compliant with the
155.St -p1003.1-2008
156specification.
157.Pp
158The flag
159.Op Fl S
160is an extension to that specification.
161.Sh HISTORY
162The
163.Nm
164utility appeared in
165.Bx 4.4 .
166.Sh BUGS
167.Nm
168can't really distinguish between different types of attributes.
169