2 .\"***************************************************************************
3 .\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
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: *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
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. *
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 *
28 .\"***************************************************************************
30 .\" $Id: tput.1,v 1.22 2005/01/08 17:44:26 tom Exp $
35 \fBtput\fR, \fBreset\fR - initialize a terminal or query terminfo database
37 \fBtput\fR [\fB-T\fR\fItype\fR] \fIcapname\fR [\fIparms\fR ... ]
39 \fBtput\fR [\fB-T\fR\fItype\fR] \fBinit\fR
41 \fBtput\fR [\fB-T\fR\fItype\fR] \fBreset\fR
43 \fBtput\fR [\fB-T\fR\fItype\fR] \fBlongname\fR
45 \fBtput -S\fR \fB<<\fR
50 The \fBtput\fR utility uses the \fBterminfo\fR database to make the
51 values of terminal-dependent capabilities and information available to
52 the shell (see \fBsh\fR(1)), to initialize or reset the terminal, or
53 return the long name of the requested terminal type.
54 The result depends upon the capability's type:
58 \fBtput\fR writes the string to the standard output.
59 No trailing newline is supplied.
62 \fBtput\fR writes the decimal value to the standard output,
63 with a trailing newline.
66 \fBtput\fR simply sets the exit code
67 (\fB0\fR for TRUE if the terminal has the capability,
68 \fB1\fR for FALSE if it does not),
69 and writes nothing to the standard output.
72 Before using a value returned on the standard output,
73 the application should test the exit code
74 (e.g., \fB$?\fR, see \fBsh\fR(1)) to be sure it is \fB0\fR.
75 (See the \fBEXIT CODES\fR and \fBDIAGNOSTICS\fR sections.)
76 For a complete list of capabilities
77 and the \fIcapname\fR associated with each, see \fBterminfo\fR(\*n).
80 indicates the \fItype\fR of terminal. Normally this option is
81 unnecessary, because the default is taken from the environment
82 variable \fBTERM\fR. If \fB-T\fR is specified, then the shell
83 variables \fBLINES\fR and \fBCOLUMNS\fR will be ignored,and the
84 operating system will not be queried for the actual screen size.
87 indicates the capability from the \fBterminfo\fR database. When
88 \fBtermcap\fR support is compiled in, the \fBtermcap\fR name for
89 the capability is also accepted.
92 If the capability is a string that takes parameters, the arguments
93 \fIparms\fR will be instantiated into the string.
95 Most parameters are numbers.
96 Only a few terminfo capabilities require string parameters;
97 \fBtput\fR uses a table to decide which to pass as strings.
98 Normally \fBtput\fR uses \fBtparm\fR (3X) to perform the substitution.
99 If no parameters are given for the capability,
100 \fBtput\fR writes the string without performing the substitution.
103 allows more than one capability per invocation of \fBtput\fR. The
104 capabilities must be passed to \fBtput\fR from the standard input
105 instead of from the command line (see example).
106 Only one \fIcapname\fR is allowed per line.
107 The \fB-S\fR option changes the
108 meaning of the \fB0\fR and \fB1\fR boolean and string exit codes (see the
111 Again, \fBtput\fR uses a table and the presence of parameters in its input
112 to decide whether to use \fBtparm\fR (3X),
113 and how to interpret the parameters.
116 reports the version of ncurses which was used in this program, and exits.
119 If the \fBterminfo\fR database is present and an entry for the user's
120 terminal exists (see \fB-T\fR\fItype\fR, above), the following will
121 occur: (1) if present, the terminal's initialization strings will be
122 output (\fBis1\fR, \fBis2\fR, \fBis3\fR, \fBif\fR, \fBiprog\fR), (2)
123 any delays (e.g., newline) specified in the entry will be set in the
124 tty driver, (3) tabs expansion will be turned on or off according to
125 the specification in the entry, and (4) if tabs are not expanded,
126 standard tabs will be set (every 8 spaces). If an entry does not
127 contain the information needed for any of the four above activities,
128 that activity will silently be skipped.
131 Instead of putting out initialization strings, the terminal's
132 reset strings will be output if present (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR, \fBrf\fR).
133 If the reset strings are not present, but initialization
134 strings are, the initialization strings will be output.
135 Otherwise, \fBreset\fR acts identically to \fBinit\fR.
138 If the \fBterminfo\fR database is present and an entry for the
139 user's terminal exists (see \fB-T\fR\fItype\fR above), then the long name
140 of the terminal will be put out. The long name is the last
141 name in the first line of the terminal's description in the
142 \fBterminfo\fR database [see \fBterm\fR(5)].
144 If \fBtput\fR is invoked by a link named \fBreset\fR, this has the
145 same effect as \fBtput reset\fR.
146 See \fBtset\fR for comparison, which has similar behavior.
150 Initialize the terminal according to the type of
151 terminal in the environmental variable \fBTERM\fR. This
152 command should be included in everyone's .profile after
153 the environmental variable \fBTERM\fR has been exported, as
154 illustrated on the \fBprofile\fR(5) manual page.
156 \fBtput -T5620 reset\fR
157 Reset an AT&T 5620 terminal, overriding the type of
158 terminal in the environmental variable \fBTERM\fR.
161 Send the sequence to move the cursor to row \fB0\fR, column \fB0\fR
162 (the upper left corner of the screen, usually known as the "home"
166 Echo the clear-screen sequence for the current terminal.
169 Print the number of columns for the current terminal.
171 \fBtput -T450 cols\fR
172 Print the number of columns for the 450 terminal.
174 \fBbold=`tput smso` offbold=`tput rmso`\fR
175 Set the shell variables \fBbold\fR, to begin stand-out mode
176 sequence, and \fBoffbold\fR, to end standout mode sequence,
177 for the current terminal. This might be followed by a
178 prompt: \fBecho "${bold}Please type in your name: ${offbold}\\c"\fR
181 Set exit code to indicate if the current terminal is a hard copy terminal.
184 Send the sequence to move the cursor to row 23, column 4.
187 Send the terminfo string for cursor-movement, with no parameters substituted.
190 Print the long name from the \fBterminfo\fR database for the
191 type of terminal specified in the environmental
207 This example shows \fBtput\fR processing several capabilities in one invocation.
208 It clears the screen,
209 moves the cursor to position 10, 10
210 and turns on bold (extra bright) mode.
211 The list is terminated by an exclamation mark (\fB!\fR) on a line by itself.
215 compiled terminal description database
217 \fB@DATADIR@/tabset/*\fR
218 tab settings for some terminals, in a format
219 appropriate to be output to the terminal (escape
220 sequences that set margins and tabs); for more
221 information, see the "Tabs and Initialization"
222 section of \fBterminfo\fR(5)
224 If the \fB-S\fR option is used,
225 \fBtput\fR checks for errors from each line,
226 and if any errors are found, will set the exit code to 4 plus the
227 number of lines with errors.
228 If no errors are found, the exit code is \fB0\fR.
229 No indication of which line failed can be given so
230 exit code \fB1\fR will never appear. Exit codes \fB2\fR, \fB3\fR, and
231 \fB4\fR retain their usual interpretation.
232 If the \fB-S\fR option is not used,
233 the exit code depends on the type of \fIcapname\fR:
237 a value of \fB0\fR is set for TRUE and \fB1\fR for FALSE.
240 a value of \fB0\fR is set if the
241 \fIcapname\fR is defined for this terminal \fItype\fR (the value of
242 \fIcapname\fR is returned on standard output);
243 a value of \fB1\fR is set if \fIcapname\fR
244 is not defined for this terminal \fItype\fR
245 (nothing is written to standard output).
248 a value of \fB0\fR is always set,
249 whether or not \fIcapname\fR is defined for this terminal \fItype\fR.
250 To determine if \fIcapname\fR is defined for this terminal \fItype\fR,
251 the user must test the value written to standard output.
253 means that \fIcapname\fR is not defined for this terminal \fItype\fR.
256 \fBreset\fR or \fBinit\fR may fail to find their respective files.
257 In that case, the exit code is set to 4 + \fBerrno\fR.
260 Any other exit code indicates an error; see the DIAGNOSTICS section.
262 \fBtput\fR prints the following error messages and sets the corresponding exit
268 exit code error message
271 (\fIcapname\fR is a numeric variable that is not specified in the
272 \fBterminfo\fR(\*n) database for this terminal type, e.g.
273 \fBtput -T450 lines\fR and \fBtput -T2621 xmc\fR)
275 \fB1\fR no error message is printed, see the \fBEXIT CODES\fR section.
277 \fB3\fR unknown terminal \fItype\fR or no \fBterminfo\fR database
278 \fB4\fR unknown \fBterminfo\fR capability \fIcapname\fR
279 \fB>4\fR error occurred in -S
283 The \fBlongname\fR and \fB-S\fR options, and the parameter-substitution
284 features used in the \fBcup\fR example, are not supported in BSD curses or in
285 AT&T/USL curses before SVr4.
292 .\"# The following sets edit modes for GNU EMACS
293 .\"# Local Variables: