xref: /openbsd/usr.bin/tput/tput.1 (revision cecf84d4)
1.\"	$OpenBSD: tput.1,v 1.21 2014/06/03 20:28:24 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: June 3 2014 $
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 ENVIRONMENT
117.Bl -tag -width Ds
118.It Ev TERM
119Determine the terminal type.
120.El
121.Sh EXIT STATUS
122The exit value of
123.Nm
124is based on the last attribute specified.
125If the attribute is of type string or of type integer the exit
126value is as follows:
127.Pp
128.Bl -tag -offset indent -width Ds -compact
129.It 0
130The requested string was written successfully.
131.It 2
132Usage error.
133.It 3
134Unknown terminal type.
135.It 4
136Unknown attribute name.
137.It >4
138An error occurred.
139.El
140.Pp
141If the attribute is of type boolean,
142.Nm
143exits with a value of 0 if the terminal has this attribute or
1441 if it does not.
145.Sh EXAMPLES
146Clear the screen and go to line 5 column 10:
147.Pp
148.Dl $ tput clear cup 5 10
149.Pp
150Go to line 6 column 11 and delete 6 characters:
151.Pp
152.Dl $ tput cup 6 11 dch 6
153.Sh SEE ALSO
154.Xr terminfo 3 ,
155.Xr terminfo 5
156.Sh STANDARDS
157The
158.Nm
159utility is compliant with the
160.St -p1003.1-2008
161specification.
162.Pp
163The flag
164.Op Fl S
165and the attribute
166.Cm longname
167are extensions to that specification.
168.Sh HISTORY
169A
170.Nm clear
171utility implementing the functionality of
172.Nm tput Cm clear
173first appeared in
174.Bx 2 .
175The
176.Nm
177utility appeared in
178.Bx 4.4 .
179.Sh BUGS
180.Nm
181can't really distinguish between different types of attributes.
182