Update ncurses to version 5.4.
[dragonfly.git] / lib / libncurses / man / tput.1
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: tput.1,v 1.20 2003/05/11 00:32:53 tom Exp $
31 .\" $DragonFly: src/lib/libncurses/man/tput.1,v 1.1 2005/03/12 19:13:54 eirikn Exp $
32 .TH tput 1 ""
33 .ds d /usr/share/terminfo
34 .ds n 1
35 .SH NAME
36 \fBtput\fR, \fBreset\fR - initialize a terminal or query terminfo database
37 .SH SYNOPSIS
38 \fBtput\fR [\fB\-T\fR\fItype\fR] \fIcapname\fR [\fIparms\fR ... ]
39 .br
40 \fBtput\fR [\fB\-T\fR\fItype\fR] \fBinit\fR
41 .br
42 \fBtput\fR [\fB\-T\fR\fItype\fR] \fBreset\fR
43 .br
44 \fBtput\fR [\fB\-T\fR\fItype\fR] \fBlongname\fR
45 .br
46 \fBtput \-S\fR  \fB<<\fR
47 .br
48 \fBtput \-V\fR
49 .br
50 .SH DESCRIPTION
51 The \fBtput\fR utility uses the \fBterminfo\fR database to make the
52 values of terminal-dependent capabilities and information available to
53 the shell (see \fBsh\fR(1)), to initialize or reset the terminal, or
54 return the long name of the requested terminal type.  \fBtput\fR
55 outputs a string if the attribute (\fIcap\fRability \fIname\fR) is of
56 type string, or an integer if the attribute is of type integer.  If
57 the attribute is of type boolean, \fBtput\fR simply sets the exit code
58 (\fB0\fR for TRUE if the terminal has the capability, \fB1\fR for
59 FALSE if it does not), and produces no output.  Before using a value
60 returned on standard output, the user should test the exit code
61 [\fB$?\fR, see \fBsh\fR(1)] to be sure it is \fB0\fR.
62 (See the \fBEXIT CODES\fR and \fBDIAGNOSTICS\fR sections.)
63 For a complete list of capabilities
64 and the \fIcapname\fR associated with each, see \fBterminfo\fR(\*n).
65 .TP
66 \fB\-T\fR\fItype\fR
67 indicates the \fItype\fR of terminal.  Normally this option is
68 unnecessary, because the default is taken from the environment
69 variable \fBTERM\fR.  If \fB\-T\fR is specified, then the shell
70 variables \fBLINES\fR and \fBCOLUMNS\fR will be ignored,and the
71 operating system will not be queried for the actual screen size.
72 .TP
73 \fIcapname\fR
74 indicates the attribute from the \fBterminfo\fR database.  When
75 \fBtermcap\fR support is compiled in, the \fBtermcap\fR name for
76 the attribute is also accepted.
77 .TP
78 \fIparms\fR
79 If the attribute is a string that takes parameters, the arguments
80 \fIparms\fR will be instantiated into the string.
81 An all-numeric argument will be passed to the attribute as a number.
82 .IP
83 Only a few terminfo capabilities require string parameters;
84 \fBtput\fR uses a table to decide which to pass as strings.
85 Normally \fBtput\fR uses \fBtparm\fR (3X) to perform the substitution.
86 If no parameters are given for the attribute,
87 \fBtput\fR writes the string without performing the substitution.
88 .TP
89 \fB\-S\fR
90 allows more than one capability per invocation of \fBtput\fR.  The
91 capabilities must be passed to \fBtput\fR from the standard input
92 instead of from the command line (see example).
93 Only one \fIcapname\fR is allowed per line.
94 The \fB\-S\fR option changes the
95 meaning of the \fB0\fR and \fB1\fR boolean and string exit codes (see the
96 EXIT CODES section).
97 .IP
98 Again, \fBtput\fR uses a table and the presence of parameters in its input
99 to decide whether to use \fBtparm\fR (3X),
100 and how to interpret the parameters.
101 .TP
102 \fB\-V\fR
103 reports the version of ncurses which was used in this program, and exits.
104 .TP
105 \fBinit\fR
106 If the \fBterminfo\fR database is present and an entry for the user's
107 terminal exists (see \fB\-T\fR\fItype\fR, above), the following will
108 occur: (1) if present, the terminal's initialization strings will be
109 output (\fBis1\fR, \fBis2\fR, \fBis3\fR, \fBif\fR, \fBiprog\fR), (2)
110 any delays (e.g., newline) specified in the entry will be set in the
111 tty driver, (3) tabs expansion will be turned on or off according to
112 the specification in the entry, and (4) if tabs are not expanded,
113 standard tabs will be set (every 8 spaces).  If an entry does not
114 contain the information needed for any of the four above activities,
115 that activity will silently be skipped.
116 .TP
117 \fBreset\fR
118 Instead of putting out initialization strings, the terminal's
119 reset strings will be output if present (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR, \fBrf\fR).
120 If the reset strings are not present, but initialization
121 strings are, the initialization strings will be output.
122 Otherwise, \fBreset\fR acts identically to \fBinit\fR.
123 .TP
124 \fBlongname\fR
125 If the \fBterminfo\fR database is present and an entry for the
126 user's terminal exists (see \fB\-T\fR\fItype\fR above), then the long name
127 of the terminal will be put out.  The long name is the last
128 name in the first line of the terminal's description in the
129 \fBterminfo\fR database [see \fBterm\fR(5)].
130 .PP
131 If \fBtput\fR is invoked by a link named \fBreset\fR, this has the
132 same effect as \fBtput reset\fR.
133 See \fBtset\fR for comparison, which has similar behavior.
134 .SH EXAMPLES
135 .TP 5
136 \fBtput init\fR
137 Initialize the terminal according to the type of
138 terminal in the environmental variable \fBTERM\fR.  This
139 command should be included in everyone's .profile after
140 the environmental variable \fBTERM\fR has been exported, as
141 illustrated on the \fBprofile\fR(5) manual page.
142 .TP 5
143 \fBtput \-T5620 reset\fR
144 Reset an AT&T 5620 terminal, overriding the type of
145 terminal in the environmental variable \fBTERM\fR.
146 .TP 5
147 \fBtput cup 0 0\fR
148 Send the sequence to move the cursor to row \fB0\fR, column \fB0\fR
149 (the upper left corner of the screen, usually known as the "home"
150 cursor position).
151 .TP 5
152 \fBtput clear\fR
153 Echo the clear-screen sequence for the current terminal.
154 .TP 5
155 \fBtput cols\fR
156 Print the number of columns for the current terminal.
157 .TP 5
158 \fBtput \-T450 cols\fR
159 Print the number of columns for the 450 terminal.
160 .TP 5
161 \fBbold=`tput smso` offbold=`tput rmso`\fR
162 Set the shell variables \fBbold\fR, to begin stand-out mode
163 sequence, and \fBoffbold\fR, to end standout mode sequence,
164 for the current terminal.  This might be followed by a
165 prompt: \fBecho "${bold}Please type in your name: ${offbold}\\c"\fR
166 .TP 5
167 \fBtput hc\fR
168 Set exit code to indicate if the current terminal is a hard copy terminal.
169 .TP 5
170 \fBtput cup 23 4\fR
171 Send the sequence to move the cursor to row 23, column 4.
172 .TP 5
173 \fBtput cup\fR
174 Send the terminfo string for cursor-movement, with no parameters substituted.
175 .TP 5
176 \fBtput longname\fR
177 Print the long name from the \fBterminfo\fR database for the
178 type of terminal specified in the environmental
179 variable \fBTERM\fR.
180 .PP
181 .RS 5
182 \fBtput \-S <<!\fR
183 .br
184 \fB> clear\fR
185 .br
186 \fB> cup 10 10\fR
187 .br
188 \fB> bold\fR
189 .br
190 \fB> !\fR
191 .RE
192 .TP 5
193 \&
194 This example shows \fBtput\fR processing several capabilities in one invocation.
195 It clears the screen,
196 moves the cursor to position 10, 10
197 and turns on bold (extra bright) mode.
198 The list is terminated by an exclamation mark (\fB!\fR) on a line by itself.
199 .SH FILES
200 .TP
201 \fB\*d\fR
202 compiled terminal description database
203 .TP
204 \fB/usr/include/curses.h\fR
205 \fBcurses\fR(3X) header file
206 .TP
207 \fB/usr/include/term.h\fR
208 \fBterminfo\fR header file
209 .TP
210 \fB/usr/share/tabset/*\fR
211 tab settings for some terminals, in a format
212 appropriate to be output to the terminal (escape
213 sequences that set margins and tabs); for more
214 information, see the "Tabs and Initialization"
215 section of \fBterminfo\fR(5)
216 .SH EXIT CODES
217 If the \fB\-S\fR option is used,
218 \fBtput\fR checks for errors from each line,
219 and if any errors are found, will set the exit code to 4 plus the
220 number of lines with errors.
221 If no errors are found, the exit code is \fB0\fR.
222 No indication of which line failed can be given so
223 exit code \fB1\fR will never appear.  Exit codes \fB2\fR, \fB3\fR, and
224 \fB4\fR retain their usual interpretation.
225 If the \fB\-S\fR option is not used,
226 the exit code depends on the type of \fIcapname\fR:
227 .RS 5
228 .TP
229 .I boolean
230 a value of \fB0\fR is set for TRUE and \fB1\fR for FALSE.
231 .TP
232 .I string
233 a value of \fB0\fR is set if the
234 \fIcapname\fR is defined for this terminal \fItype\fR (the value of
235 \fIcapname\fR is returned on standard output);
236 a value of \fB1\fR is set if \fIcapname\fR
237 is not defined for this terminal \fItype\fR
238 (nothing is written to standard output).
239 .TP
240 .I integer
241 a value of \fB0\fR is always set,
242 whether or not \fIcapname\fR is defined for this terminal \fItype\fR.
243 To determine if \fIcapname\fR is defined for this terminal \fItype\fR,
244 the user must test the value written to standard output.
245 A value of \fB\-1\fR
246 means that \fIcapname\fR is not defined for this terminal \fItype\fR.
247 .TP
248 .I other
249 \fBreset\fR or \fBinit\fR may fail to find their respective files.
250 In that case, the exit code is set to 4 + \fBerrno\fR.
251 .RE
252 .PP
253 Any other exit code indicates an error; see the DIAGNOSTICS section.
254 .SH DIAGNOSTICS
255 \fBtput\fR prints the following error messages and sets the corresponding exit
256 codes.
257 .PP
258 .ne 15
259 .TS
260 l l.
261 exit code       error message
262 =
263 \fB0\fR T{
264 (\fIcapname\fR is a numeric variable that is not specified in the
265 \fBterminfo\fR(\*n) database for this terminal type, e.g.
266 \fBtput \-T450 lines\fR and \fBtput \-T2621 xmc\fR)
267 T}
268 \fB1\fR no error message is printed, see the \fBEXIT CODES\fR section.
269 \fB2\fR usage error
270 \fB3\fR unknown terminal \fItype\fR or no \fBterminfo\fR database
271 \fB4\fR unknown \fBterminfo\fR capability \fIcapname\fR
272 \fB>4\fR        error occurred in \-S
273 =
274 .TE
275 .SH PORTABILITY
276 The \fBlongname\fR and \fB\-S\fR options, and the parameter-substitution
277 features used in the \fBcup\fR example, are not supported in BSD curses or in
278 AT&T/USL curses before SVr4.
279 .SH SEE ALSO
280 \fBclear\fR(1),
281 \fBstty\fR(1),
282 \fBtabs\fR(\*n),
283 \fBterminfo\fR(5).
284 .\"#
285 .\"# The following sets edit modes for GNU EMACS
286 .\"# Local Variables:
287 .\"# mode:nroff
288 .\"# fill-column:79
289 .\"# End: