blob: a1b81bcb08c5879111bd74e2c63a5e4ce87c0eef [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301'\" t
2.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01003.\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
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.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010030.\" $Id: tput.1,v 1.32 2012/07/14 21:06:45 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053031.TH @TPUT@ 1 ""
32.ds d @TERMINFO@
33.ds n 1
34.SH NAME
Steve Kondikae271bc2015-11-15 02:50:53 +010035\fB@TPUT@\fR, \fBreset\fR \- initialize a terminal or query terminfo database
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053036.SH SYNOPSIS
Steve Kondikae271bc2015-11-15 02:50:53 +010037\fB@TPUT@\fR [\fB\-T\fR\fItype\fR] \fIcapname\fR [\fIparms\fR ... ]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053038.br
Steve Kondikae271bc2015-11-15 02:50:53 +010039\fB@TPUT@\fR [\fB\-T\fR\fItype\fR] \fBinit\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053040.br
Steve Kondikae271bc2015-11-15 02:50:53 +010041\fB@TPUT@\fR [\fB\-T\fR\fItype\fR] \fBreset\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053042.br
Steve Kondikae271bc2015-11-15 02:50:53 +010043\fB@TPUT@\fR [\fB\-T\fR\fItype\fR] \fBlongname\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053044.br
Steve Kondikae271bc2015-11-15 02:50:53 +010045\fB@TPUT@ \-S\fR \fB<<\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053046.br
Steve Kondikae271bc2015-11-15 02:50:53 +010047\fB@TPUT@ \-V\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053048.br
49.SH DESCRIPTION
50The \fB@TPUT@\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\fB@TPUT@\fR writes the string to the standard output.
59No trailing newline is supplied.
60.TP
61integer
62\fB@TPUT@\fR writes the decimal value to the standard output,
63with a trailing newline.
64.TP
65boolean
66\fB@TPUT@\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(5).
78.TP
Steve Kondikae271bc2015-11-15 02:50:53 +010079\fB\-T\fR\fItype\fR
80indicates the \fItype\fR of terminal.
81Normally this option is
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053082unnecessary, because the default is taken from the environment
Steve Kondikae271bc2015-11-15 02:50:53 +010083variable \fBTERM\fR.
84If \fB\-T\fR is specified, then the shell
85variables \fBLINES\fR and \fBCOLUMNS\fR will also be ignored.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053086.TP
87\fIcapname\fR
88indicates the capability from the \fBterminfo\fR database. When
89\fBtermcap\fR support is compiled in, the \fBtermcap\fR name for
90the capability is also accepted.
91.TP
92\fIparms\fR
93If the capability is a string that takes parameters, the arguments
94\fIparms\fR will be instantiated into the string.
95.IP
96Most parameters are numbers.
97Only a few terminfo capabilities require string parameters;
98\fB@TPUT@\fR uses a table to decide which to pass as strings.
99Normally \fB@TPUT@\fR uses \fBtparm\fR (3X) to perform the substitution.
100If no parameters are given for the capability,
101\fB@TPUT@\fR writes the string without performing the substitution.
102.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100103\fB\-S\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530104allows more than one capability per invocation of \fB@TPUT@\fR. The
105capabilities must be passed to \fB@TPUT@\fR from the standard input
106instead of from the command line (see example).
107Only one \fIcapname\fR is allowed per line.
Steve Kondikae271bc2015-11-15 02:50:53 +0100108The \fB\-S\fR option changes the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530109meaning of the \fB0\fR and \fB1\fR boolean and string exit codes (see the
110EXIT CODES section).
111.IP
112Again, \fB@TPUT@\fR uses a table and the presence of parameters in its input
113to decide whether to use \fBtparm\fR (3X),
114and how to interpret the parameters.
115.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100116\fB\-V\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530117reports the version of ncurses which was used in this program, and exits.
118.TP
119\fBinit\fR
120If the \fBterminfo\fR database is present and an entry for the user's
Steve Kondikae271bc2015-11-15 02:50:53 +0100121terminal exists (see \fB\-T\fR\fItype\fR, above), the following will
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530122occur:
123.RS
124.TP
125(1)
126if present, the terminal's initialization strings will be
127output as detailed in the \fBterminfo\fR(5) section on
128.IR "Tabs and Initialization" ,
129.TP
130(2)
131any delays (e.g., newline) specified in the entry will
132be set in the tty driver,
133.TP
134(3)
135tabs expansion will be turned on or off according to
136the specification in the entry, and
137.TP
138(4)
139if tabs are not expanded,
140standard tabs will be set (every 8 spaces).
141.RE
142.IP
143If an entry does not
144contain the information needed for any of the four above activities,
145that activity will silently be skipped.
146.TP
147\fBreset\fR
148Instead of putting out initialization strings, the terminal's
149reset strings will be output if present (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR, \fBrf\fR).
150If the reset strings are not present, but initialization
151strings are, the initialization strings will be output.
152Otherwise, \fBreset\fR acts identically to \fBinit\fR.
153.TP
154\fBlongname\fR
155If the \fBterminfo\fR database is present and an entry for the
Steve Kondikae271bc2015-11-15 02:50:53 +0100156user's terminal exists (see \fB\-T\fR\fItype\fR above), then the long name
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530157of the terminal will be put out. The long name is the last
158name in the first line of the terminal's description in the
159\fBterminfo\fR database [see \fBterm\fR(5)].
160.PP
161If \fB@TPUT@\fR is invoked by a link named \fBreset\fR, this has the
162same effect as \fB@TPUT@ reset\fR.
Steve Kondikae271bc2015-11-15 02:50:53 +0100163See \fB@TSET@\fR for comparison, which has similar behavior.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530164.SH EXAMPLES
165.TP 5
166\fB@TPUT@ init\fR
167Initialize the terminal according to the type of
168terminal in the environmental variable \fBTERM\fR. This
169command should be included in everyone's .profile after
170the environmental variable \fBTERM\fR has been exported, as
171illustrated on the \fBprofile\fR(5) manual page.
172.TP 5
Steve Kondikae271bc2015-11-15 02:50:53 +0100173\fB@TPUT@ \-T5620 reset\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530174Reset an AT&T 5620 terminal, overriding the type of
175terminal in the environmental variable \fBTERM\fR.
176.TP 5
177\fB@TPUT@ cup 0 0\fR
178Send the sequence to move the cursor to row \fB0\fR, column \fB0\fR
179(the upper left corner of the screen, usually known as the "home"
180cursor position).
181.TP 5
182\fB@TPUT@ clear\fR
183Echo the clear-screen sequence for the current terminal.
184.TP 5
185\fB@TPUT@ cols\fR
186Print the number of columns for the current terminal.
187.TP 5
Steve Kondikae271bc2015-11-15 02:50:53 +0100188\fB@TPUT@ \-T450 cols\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530189Print the number of columns for the 450 terminal.
190.TP 5
191\fBbold=`@TPUT@ smso` offbold=`@TPUT@ rmso`\fR
192Set the shell variables \fBbold\fR, to begin stand-out mode
193sequence, and \fBoffbold\fR, to end standout mode sequence,
194for the current terminal. This might be followed by a
195prompt: \fBecho "${bold}Please type in your name: ${offbold}\\c"\fR
196.TP 5
197\fB@TPUT@ hc\fR
198Set exit code to indicate if the current terminal is a hard copy terminal.
199.TP 5
200\fB@TPUT@ cup 23 4\fR
201Send the sequence to move the cursor to row 23, column 4.
202.TP 5
203\fB@TPUT@ cup\fR
204Send the terminfo string for cursor-movement, with no parameters substituted.
205.TP 5
206\fB@TPUT@ longname\fR
207Print the long name from the \fBterminfo\fR database for the
208type of terminal specified in the environmental
209variable \fBTERM\fR.
210.PP
211.RS 5
Steve Kondikae271bc2015-11-15 02:50:53 +0100212\fB@TPUT@ \-S <<!\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530213.br
214\fB> clear\fR
215.br
216\fB> cup 10 10\fR
217.br
218\fB> bold\fR
219.br
220\fB> !\fR
221.RE
222.TP 5
223\&
224This example shows \fB@TPUT@\fR processing several capabilities in one invocation.
225It clears the screen,
226moves the cursor to position 10, 10
227and turns on bold (extra bright) mode.
228The list is terminated by an exclamation mark (\fB!\fR) on a line by itself.
229.SH FILES
230.TP
231\fB\*d\fR
232compiled terminal description database
233.TP
234\fB@DATADIR@/tabset/*\fR
235tab settings for some terminals, in a format
236appropriate to be output to the terminal (escape
237sequences that set margins and tabs); for more
238information, see the "Tabs and Initialization"
239section of \fBterminfo\fR(5)
240.SH EXIT CODES
Steve Kondikae271bc2015-11-15 02:50:53 +0100241If the \fB\-S\fR option is used,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530242\fB@TPUT@\fR checks for errors from each line,
243and if any errors are found, will set the exit code to 4 plus the
244number of lines with errors.
245If no errors are found, the exit code is \fB0\fR.
246No indication of which line failed can be given so
247exit code \fB1\fR will never appear. Exit codes \fB2\fR, \fB3\fR, and
248\fB4\fR retain their usual interpretation.
Steve Kondikae271bc2015-11-15 02:50:53 +0100249If the \fB\-S\fR option is not used,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530250the exit code depends on the type of \fIcapname\fR:
251.RS 5
252.TP
253.I boolean
254a value of \fB0\fR is set for TRUE and \fB1\fR for FALSE.
255.TP
256.I string
257a value of \fB0\fR is set if the
258\fIcapname\fR is defined for this terminal \fItype\fR (the value of
259\fIcapname\fR is returned on standard output);
260a value of \fB1\fR is set if \fIcapname\fR
261is not defined for this terminal \fItype\fR
262(nothing is written to standard output).
263.TP
264.I integer
265a value of \fB0\fR is always set,
266whether or not \fIcapname\fR is defined for this terminal \fItype\fR.
267To determine if \fIcapname\fR is defined for this terminal \fItype\fR,
268the user must test the value written to standard output.
Steve Kondikae271bc2015-11-15 02:50:53 +0100269A value of \fB\-1\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530270means that \fIcapname\fR is not defined for this terminal \fItype\fR.
271.TP
272.I other
273\fBreset\fR or \fBinit\fR may fail to find their respective files.
274In that case, the exit code is set to 4 + \fBerrno\fR.
275.RE
276.PP
277Any other exit code indicates an error; see the DIAGNOSTICS section.
278.SH DIAGNOSTICS
Steve Kondikae271bc2015-11-15 02:50:53 +0100279\fB@TPUT@\fR prints the following error messages and sets the corresponding exit
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530280codes.
281.PP
282.ne 15
283.TS
284l l.
285exit code error message
286=
287\fB0\fR T{
288(\fIcapname\fR is a numeric variable that is not specified in the
289\fBterminfo\fR(5) database for this terminal type, e.g.
Steve Kondikae271bc2015-11-15 02:50:53 +0100290\fB@TPUT@ \-T450 lines\fR and \fB@TPUT@ \-T2621 xmc\fR)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530291T}
292\fB1\fR no error message is printed, see the \fBEXIT CODES\fR section.
293\fB2\fR usage error
294\fB3\fR unknown terminal \fItype\fR or no \fBterminfo\fR database
295\fB4\fR unknown \fBterminfo\fR capability \fIcapname\fR
Steve Kondikae271bc2015-11-15 02:50:53 +0100296\fB>4\fR error occurred in \-S
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530297=
298.TE
299.SH PORTABILITY
300.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100301The \fBlongname\fR and \fB\-S\fR options, and the parameter-substitution
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530302features used in the \fBcup\fR example, are not supported in BSD curses or in
303AT&T/USL curses before SVr4.
304.PP
305X/Open documents only the operands for \fBclear\fP, \fBinit\fP and \fBreset\fP.
306In this implementation, \fBclear\fP is part of the \fIcapname\fR support.
Steve Kondikae271bc2015-11-15 02:50:53 +0100307Other implementations of \fB@TPUT@\fP on
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530308SVr4-based systems such as Solaris, IRIX64 and HPUX
309as well as others such as AIX and Tru64
310provide support for \fIcapname\fR operands.
Steve Kondikae271bc2015-11-15 02:50:53 +0100311.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530312A few platforms such as FreeBSD and NetBSD recognize termcap names rather
Steve Kondikae271bc2015-11-15 02:50:53 +0100313than terminfo capability names in their respective \fB@TPUT@\fP commands.
314.PP
315Most implementations which provide support for \fIcapname\fR operands
316use the \fItparm\fP function to expand parameters in it.
317That function expects a mixture of numeric and string parameters,
318requiring \fB@TPUT@\fP to know which type to use.
319This implementation uses a table to determine that for
320the standard \fIcapname\fR operands, and an internal library
321function to analyze nonstandard \fIcapname\fR operands.
322Other implementations may simply guess that an operand containing only digits
323is intended to be a number.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530324.SH SEE ALSO
325\fB@CLEAR@\fR(1),
326\fBstty\fR(1),
327\fBtabs\fR(\*n),
Steve Kondikae271bc2015-11-15 02:50:53 +0100328\fBterminfo\fR(5),
329\fBcurs_termcap\fR(3X).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530330.PP
331This describes \fBncurses\fR
332version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).