blob: bada0b1595ed46f4c82fba408e949976c4143eff [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301'\" t
2.\"***************************************************************************
3.\" Copyright (c) 1998-2005,2006 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.27 2006/12/24 18:11:31 tom Exp $
31.TH @TPUT@ 1 ""
32.ds d @TERMINFO@
33.ds n 1
34.SH NAME
35\fB@TPUT@\fR, \fBreset\fR - initialize a terminal or query terminfo database
36.SH SYNOPSIS
37\fB@TPUT@\fR [\fB-T\fR\fItype\fR] \fIcapname\fR [\fIparms\fR ... ]
38.br
39\fB@TPUT@\fR [\fB-T\fR\fItype\fR] \fBinit\fR
40.br
41\fB@TPUT@\fR [\fB-T\fR\fItype\fR] \fBreset\fR
42.br
43\fB@TPUT@\fR [\fB-T\fR\fItype\fR] \fBlongname\fR
44.br
45\fB@TPUT@ -S\fR \fB<<\fR
46.br
47\fB@TPUT@ -V\fR
48.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
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\fB@TPUT@\fR uses a table to decide which to pass as strings.
98Normally \fB@TPUT@\fR uses \fBtparm\fR (3X) to perform the substitution.
99If no parameters are given for the capability,
100\fB@TPUT@\fR writes the string without performing the substitution.
101.TP
102\fB-S\fR
103allows more than one capability per invocation of \fB@TPUT@\fR. The
104capabilities must be passed to \fB@TPUT@\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, \fB@TPUT@\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:
122.RS
123.TP
124(1)
125if present, the terminal's initialization strings will be
126output as detailed in the \fBterminfo\fR(5) section on
127.IR "Tabs and Initialization" ,
128.TP
129(2)
130any delays (e.g., newline) specified in the entry will
131be set in the tty driver,
132.TP
133(3)
134tabs expansion will be turned on or off according to
135the specification in the entry, and
136.TP
137(4)
138if tabs are not expanded,
139standard tabs will be set (every 8 spaces).
140.RE
141.IP
142If an entry does not
143contain the information needed for any of the four above activities,
144that activity will silently be skipped.
145.TP
146\fBreset\fR
147Instead of putting out initialization strings, the terminal's
148reset strings will be output if present (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR, \fBrf\fR).
149If the reset strings are not present, but initialization
150strings are, the initialization strings will be output.
151Otherwise, \fBreset\fR acts identically to \fBinit\fR.
152.TP
153\fBlongname\fR
154If the \fBterminfo\fR database is present and an entry for the
155user's terminal exists (see \fB-T\fR\fItype\fR above), then the long name
156of the terminal will be put out. The long name is the last
157name in the first line of the terminal's description in the
158\fBterminfo\fR database [see \fBterm\fR(5)].
159.PP
160If \fB@TPUT@\fR is invoked by a link named \fBreset\fR, this has the
161same effect as \fB@TPUT@ reset\fR.
162See \fBtset\fR for comparison, which has similar behavior.
163.SH EXAMPLES
164.TP 5
165\fB@TPUT@ init\fR
166Initialize the terminal according to the type of
167terminal in the environmental variable \fBTERM\fR. This
168command should be included in everyone's .profile after
169the environmental variable \fBTERM\fR has been exported, as
170illustrated on the \fBprofile\fR(5) manual page.
171.TP 5
172\fB@TPUT@ -T5620 reset\fR
173Reset an AT&T 5620 terminal, overriding the type of
174terminal in the environmental variable \fBTERM\fR.
175.TP 5
176\fB@TPUT@ cup 0 0\fR
177Send the sequence to move the cursor to row \fB0\fR, column \fB0\fR
178(the upper left corner of the screen, usually known as the "home"
179cursor position).
180.TP 5
181\fB@TPUT@ clear\fR
182Echo the clear-screen sequence for the current terminal.
183.TP 5
184\fB@TPUT@ cols\fR
185Print the number of columns for the current terminal.
186.TP 5
187\fB@TPUT@ -T450 cols\fR
188Print the number of columns for the 450 terminal.
189.TP 5
190\fBbold=`@TPUT@ smso` offbold=`@TPUT@ rmso`\fR
191Set the shell variables \fBbold\fR, to begin stand-out mode
192sequence, and \fBoffbold\fR, to end standout mode sequence,
193for the current terminal. This might be followed by a
194prompt: \fBecho "${bold}Please type in your name: ${offbold}\\c"\fR
195.TP 5
196\fB@TPUT@ hc\fR
197Set exit code to indicate if the current terminal is a hard copy terminal.
198.TP 5
199\fB@TPUT@ cup 23 4\fR
200Send the sequence to move the cursor to row 23, column 4.
201.TP 5
202\fB@TPUT@ cup\fR
203Send the terminfo string for cursor-movement, with no parameters substituted.
204.TP 5
205\fB@TPUT@ longname\fR
206Print the long name from the \fBterminfo\fR database for the
207type of terminal specified in the environmental
208variable \fBTERM\fR.
209.PP
210.RS 5
211\fB@TPUT@ -S <<!\fR
212.br
213\fB> clear\fR
214.br
215\fB> cup 10 10\fR
216.br
217\fB> bold\fR
218.br
219\fB> !\fR
220.RE
221.TP 5
222\&
223This example shows \fB@TPUT@\fR processing several capabilities in one invocation.
224It clears the screen,
225moves the cursor to position 10, 10
226and turns on bold (extra bright) mode.
227The list is terminated by an exclamation mark (\fB!\fR) on a line by itself.
228.SH FILES
229.TP
230\fB\*d\fR
231compiled terminal description database
232.TP
233\fB@DATADIR@/tabset/*\fR
234tab settings for some terminals, in a format
235appropriate to be output to the terminal (escape
236sequences that set margins and tabs); for more
237information, see the "Tabs and Initialization"
238section of \fBterminfo\fR(5)
239.SH EXIT CODES
240If the \fB-S\fR option is used,
241\fB@TPUT@\fR checks for errors from each line,
242and if any errors are found, will set the exit code to 4 plus the
243number of lines with errors.
244If no errors are found, the exit code is \fB0\fR.
245No indication of which line failed can be given so
246exit code \fB1\fR will never appear. Exit codes \fB2\fR, \fB3\fR, and
247\fB4\fR retain their usual interpretation.
248If the \fB-S\fR option is not used,
249the exit code depends on the type of \fIcapname\fR:
250.RS 5
251.TP
252.I boolean
253a value of \fB0\fR is set for TRUE and \fB1\fR for FALSE.
254.TP
255.I string
256a value of \fB0\fR is set if the
257\fIcapname\fR is defined for this terminal \fItype\fR (the value of
258\fIcapname\fR is returned on standard output);
259a value of \fB1\fR is set if \fIcapname\fR
260is not defined for this terminal \fItype\fR
261(nothing is written to standard output).
262.TP
263.I integer
264a value of \fB0\fR is always set,
265whether or not \fIcapname\fR is defined for this terminal \fItype\fR.
266To determine if \fIcapname\fR is defined for this terminal \fItype\fR,
267the user must test the value written to standard output.
268A value of \fB-1\fR
269means that \fIcapname\fR is not defined for this terminal \fItype\fR.
270.TP
271.I other
272\fBreset\fR or \fBinit\fR may fail to find their respective files.
273In that case, the exit code is set to 4 + \fBerrno\fR.
274.RE
275.PP
276Any other exit code indicates an error; see the DIAGNOSTICS section.
277.SH DIAGNOSTICS
278\fBtput\fR prints the following error messages and sets the corresponding exit
279codes.
280.PP
281.ne 15
282.TS
283l l.
284exit code error message
285=
286\fB0\fR T{
287(\fIcapname\fR is a numeric variable that is not specified in the
288\fBterminfo\fR(5) database for this terminal type, e.g.
289\fB@TPUT@ -T450 lines\fR and \fB@TPUT@ -T2621 xmc\fR)
290T}
291\fB1\fR no error message is printed, see the \fBEXIT CODES\fR section.
292\fB2\fR usage error
293\fB3\fR unknown terminal \fItype\fR or no \fBterminfo\fR database
294\fB4\fR unknown \fBterminfo\fR capability \fIcapname\fR
295\fB>4\fR error occurred in -S
296=
297.TE
298.SH PORTABILITY
299.PP
300The \fBlongname\fR and \fB-S\fR options, and the parameter-substitution
301features used in the \fBcup\fR example, are not supported in BSD curses or in
302AT&T/USL curses before SVr4.
303.PP
304X/Open documents only the operands for \fBclear\fP, \fBinit\fP and \fBreset\fP.
305In this implementation, \fBclear\fP is part of the \fIcapname\fR support.
306Other implementations of \fBtput\fP on
307SVr4-based systems such as Solaris, IRIX64 and HPUX
308as well as others such as AIX and Tru64
309provide support for \fIcapname\fR operands.
310A few platforms such as FreeBSD and NetBSD recognize termcap names rather
311than terminfo capability names in their respective \fBtput\fP commands.
312.SH SEE ALSO
313\fB@CLEAR@\fR(1),
314\fBstty\fR(1),
315\fBtabs\fR(\*n),
316\fBterminfo\fR(5).
317.PP
318This describes \fBncurses\fR
319version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).
320.\"#
321.\"# The following sets edit modes for GNU EMACS
322.\"# Local Variables:
323.\"# mode:nroff
324.\"# fill-column:79
325.\"# End: