source: trunk/ncurses/man/tput.1@ 2787

Last change on this file since 2787 was 2621, checked in by bird, 19 years ago

GNU ncurses 5.5

File size: 11.1 KB
Line 
1'\" t
2.\"***************************************************************************
3.\" Copyright (c) 1998-2004,2005 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.22 2005/01/08 17:44:26 tom Exp $
31.TH tput 1 ""
32.ds d @TERMINFO@
33.ds n 1
34.SH NAME
35\fBtput\fR, \fBreset\fR - initialize a terminal or query terminfo database
36.SH SYNOPSIS
37\fBtput\fR [\fB-T\fR\fItype\fR] \fIcapname\fR [\fIparms\fR ... ]
38.br
39\fBtput\fR [\fB-T\fR\fItype\fR] \fBinit\fR
40.br
41\fBtput\fR [\fB-T\fR\fItype\fR] \fBreset\fR
42.br
43\fBtput\fR [\fB-T\fR\fItype\fR] \fBlongname\fR
44.br
45\fBtput -S\fR \fB<<\fR
46.br
47\fBtput -V\fR
48.br
49.SH DESCRIPTION
50The \fBtput\fR utility uses the \fBterminfo\fR database to make the
51values of terminal-dependent capabilities and information available to
52the shell (see \fBsh\fR(1)), to initialize or reset the terminal, or
53return the long name of the requested terminal type.
54The result depends upon the capability's type:
55.RS
56.TP 5
57string
58\fBtput\fR writes the string to the standard output.
59No trailing newline is supplied.
60.TP
61integer
62\fBtput\fR writes the decimal value to the standard output,
63with a trailing newline.
64.TP
65boolean
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),
69and writes nothing to the standard output.
70.RE
71.PP
72Before using a value returned on the standard output,
73the 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.)
76For a complete list of capabilities
77and the \fIcapname\fR associated with each, see \fBterminfo\fR(\*n).
78.TP
79\fB-T\fR\fItype\fR
80indicates the \fItype\fR of terminal. Normally this option is
81unnecessary, because the default is taken from the environment
82variable \fBTERM\fR. If \fB-T\fR is specified, then the shell
83variables \fBLINES\fR and \fBCOLUMNS\fR will be ignored,and the
84operating system will not be queried for the actual screen size.
85.TP
86\fIcapname\fR
87indicates the capability from the \fBterminfo\fR database. When
88\fBtermcap\fR support is compiled in, the \fBtermcap\fR name for
89the capability is also accepted.
90.TP
91\fIparms\fR
92If the capability is a string that takes parameters, the arguments
93\fIparms\fR will be instantiated into the string.
94.IP
95Most parameters are numbers.
96Only a few terminfo capabilities require string parameters;
97\fBtput\fR uses a table to decide which to pass as strings.
98Normally \fBtput\fR uses \fBtparm\fR (3X) to perform the substitution.
99If no parameters are given for the capability,
100\fBtput\fR writes the string without performing the substitution.
101.TP
102\fB-S\fR
103allows more than one capability per invocation of \fBtput\fR. The
104capabilities must be passed to \fBtput\fR from the standard input
105instead of from the command line (see example).
106Only one \fIcapname\fR is allowed per line.
107The \fB-S\fR option changes the
108meaning of the \fB0\fR and \fB1\fR boolean and string exit codes (see the
109EXIT CODES section).
110.IP
111Again, \fBtput\fR uses a table and the presence of parameters in its input
112to decide whether to use \fBtparm\fR (3X),
113and how to interpret the parameters.
114.TP
115\fB-V\fR
116reports the version of ncurses which was used in this program, and exits.
117.TP
118\fBinit\fR
119If the \fBterminfo\fR database is present and an entry for the user's
120terminal exists (see \fB-T\fR\fItype\fR, above), the following will
121occur: (1) if present, the terminal's initialization strings will be
122output (\fBis1\fR, \fBis2\fR, \fBis3\fR, \fBif\fR, \fBiprog\fR), (2)
123any delays (e.g., newline) specified in the entry will be set in the
124tty driver, (3) tabs expansion will be turned on or off according to
125the specification in the entry, and (4) if tabs are not expanded,
126standard tabs will be set (every 8 spaces). If an entry does not
127contain the information needed for any of the four above activities,
128that activity will silently be skipped.
129.TP
130\fBreset\fR
131Instead of putting out initialization strings, the terminal's
132reset strings will be output if present (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR, \fBrf\fR).
133If the reset strings are not present, but initialization
134strings are, the initialization strings will be output.
135Otherwise, \fBreset\fR acts identically to \fBinit\fR.
136.TP
137\fBlongname\fR
138If the \fBterminfo\fR database is present and an entry for the
139user's terminal exists (see \fB-T\fR\fItype\fR above), then the long name
140of the terminal will be put out. The long name is the last
141name in the first line of the terminal's description in the
142\fBterminfo\fR database [see \fBterm\fR(5)].
143.PP
144If \fBtput\fR is invoked by a link named \fBreset\fR, this has the
145same effect as \fBtput reset\fR.
146See \fBtset\fR for comparison, which has similar behavior.
147.SH EXAMPLES
148.TP 5
149\fBtput init\fR
150Initialize the terminal according to the type of
151terminal in the environmental variable \fBTERM\fR. This
152command should be included in everyone's .profile after
153the environmental variable \fBTERM\fR has been exported, as
154illustrated on the \fBprofile\fR(5) manual page.
155.TP 5
156\fBtput -T5620 reset\fR
157Reset an AT&T 5620 terminal, overriding the type of
158terminal in the environmental variable \fBTERM\fR.
159.TP 5
160\fBtput cup 0 0\fR
161Send 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"
163cursor position).
164.TP 5
165\fBtput clear\fR
166Echo the clear-screen sequence for the current terminal.
167.TP 5
168\fBtput cols\fR
169Print the number of columns for the current terminal.
170.TP 5
171\fBtput -T450 cols\fR
172Print the number of columns for the 450 terminal.
173.TP 5
174\fBbold=`tput smso` offbold=`tput rmso`\fR
175Set the shell variables \fBbold\fR, to begin stand-out mode
176sequence, and \fBoffbold\fR, to end standout mode sequence,
177for the current terminal. This might be followed by a
178prompt: \fBecho "${bold}Please type in your name: ${offbold}\\c"\fR
179.TP 5
180\fBtput hc\fR
181Set exit code to indicate if the current terminal is a hard copy terminal.
182.TP 5
183\fBtput cup 23 4\fR
184Send the sequence to move the cursor to row 23, column 4.
185.TP 5
186\fBtput cup\fR
187Send the terminfo string for cursor-movement, with no parameters substituted.
188.TP 5
189\fBtput longname\fR
190Print the long name from the \fBterminfo\fR database for the
191type of terminal specified in the environmental
192variable \fBTERM\fR.
193.PP
194.RS 5
195\fBtput -S <<!\fR
196.br
197\fB> clear\fR
198.br
199\fB> cup 10 10\fR
200.br
201\fB> bold\fR
202.br
203\fB> !\fR
204.RE
205.TP 5
206\&
207This example shows \fBtput\fR processing several capabilities in one invocation.
208It clears the screen,
209moves the cursor to position 10, 10
210and turns on bold (extra bright) mode.
211The list is terminated by an exclamation mark (\fB!\fR) on a line by itself.
212.SH FILES
213.TP
214\fB\*d\fR
215compiled terminal description database
216.TP
217\fB@DATADIR@/tabset/*\fR
218tab settings for some terminals, in a format
219appropriate to be output to the terminal (escape
220sequences that set margins and tabs); for more
221information, see the "Tabs and Initialization"
222section of \fBterminfo\fR(5)
223.SH EXIT CODES
224If the \fB-S\fR option is used,
225\fBtput\fR checks for errors from each line,
226and if any errors are found, will set the exit code to 4 plus the
227number of lines with errors.
228If no errors are found, the exit code is \fB0\fR.
229No indication of which line failed can be given so
230exit code \fB1\fR will never appear. Exit codes \fB2\fR, \fB3\fR, and
231\fB4\fR retain their usual interpretation.
232If the \fB-S\fR option is not used,
233the exit code depends on the type of \fIcapname\fR:
234.RS 5
235.TP
236.I boolean
237a value of \fB0\fR is set for TRUE and \fB1\fR for FALSE.
238.TP
239.I string
240a 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);
243a value of \fB1\fR is set if \fIcapname\fR
244is not defined for this terminal \fItype\fR
245(nothing is written to standard output).
246.TP
247.I integer
248a value of \fB0\fR is always set,
249whether or not \fIcapname\fR is defined for this terminal \fItype\fR.
250To determine if \fIcapname\fR is defined for this terminal \fItype\fR,
251the user must test the value written to standard output.
252A value of \fB-1\fR
253means that \fIcapname\fR is not defined for this terminal \fItype\fR.
254.TP
255.I other
256\fBreset\fR or \fBinit\fR may fail to find their respective files.
257In that case, the exit code is set to 4 + \fBerrno\fR.
258.RE
259.PP
260Any other exit code indicates an error; see the DIAGNOSTICS section.
261.SH DIAGNOSTICS
262\fBtput\fR prints the following error messages and sets the corresponding exit
263codes.
264.PP
265.ne 15
266.TS
267l l.
268exit code error message
269=
270\fB0\fR T{
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)
274T}
275\fB1\fR no error message is printed, see the \fBEXIT CODES\fR section.
276\fB2\fR usage error
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
280=
281.TE
282.SH PORTABILITY
283The \fBlongname\fR and \fB-S\fR options, and the parameter-substitution
284features used in the \fBcup\fR example, are not supported in BSD curses or in
285AT&T/USL curses before SVr4.
286.SH SEE ALSO
287\fB@CLEAR@\fR(1),
288\fBstty\fR(1),
289\fBtabs\fR(\*n),
290\fBterminfo\fR(5).
291.\"#
292.\"# The following sets edit modes for GNU EMACS
293.\"# Local Variables:
294.\"# mode:nroff
295.\"# fill-column:79
296.\"# End:
Note: See TracBrowser for help on using the repository browser.