]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tput.1
ncurses 5.2
[ncurses.git] / man / tput.1
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright (c) 1998,2000 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.16 2000/09/09 20:43:33 tom Exp $
31 .TH tput 1 ""
32 .ds d @TERMINFO@
33 .ds n 5
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
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.  \fBtput\fR
54 outputs a string if the attribute (\fIcap\fRability \fIname\fR) is of
55 type string, or an integer if the attribute is of type integer.  If
56 the attribute is of type boolean, \fBtput\fR simply sets the exit code
57 (\fB0\fR for TRUE if the terminal has the capability, \fB1\fR for
58 FALSE if it does not), and produces no output.  Before using a value
59 returned on standard output, the user should test the exit code
60 [\fB$?\fR, see \fBsh\fR(1)] to be sure it is \fB0\fR.
61 (See the \fBEXIT CODES\fR and \fBDIAGNOSTICS\fR sections.)
62 For a complete list of capabilities
63 and the \fIcapname\fR associated with each, see \fBterminfo\fR(\*n).
64 .TP
65 \fB-T\fR\fItype\fR
66 indicates the \fItype\fR of terminal.  Normally this option is
67 unnecessary, because the default is taken from the environment
68 variable \fBTERM\fR.  If \fB-T\fR is specified, then the shell
69 variables \fBLINES\fR and \fBCOLUMNS\fR will be ignored,and the
70 operating system will not be queried for the actual screen size.
71 .TP
72 \fIcapname\fR
73 indicates the attribute from the \fBterminfo\fR database.  When
74 \fBtermcap\fR support is compiled in, the \fBtermcap\fR name for
75 the attribute is also accepted.
76 .TP
77 \fIparms\fR
78 If the attribute is a string that takes parameters, the arguments
79 \fIparms\fR will be instantiated into the string.  An all numeric
80 argument will be passed to the attribute as a number.
81 .TP
82 \fB-S\fR
83 allows more than one capability per invocation of \fBtput\fR.  The
84 capabilities must be passed to \fBtput\fR from the standard input
85 instead of from the command line (see example).  Only one
86 \fIcapname\fR is allowed per line.  The \fB-S\fR option changes the
87 meaning of the \fB0\fR and \fB1\fR boolean and string exit codes (see the
88 EXIT CODES section).
89 .TP
90 \fB-V\fR
91 reports the version of ncurses which was used in this program, and exits.
92 .TP
93 \fBinit\fR
94 If the \fBterminfo\fR database is present and an entry for the user's
95 terminal exists (see \fB-T\fR\fItype\fR, above), the following will
96 occur: (1) if present, the terminal's initialization strings will be
97 output (\fBis1\fR, \fBis2\fR, \fBis3\fR, \fBif\fR, \fBiprog\fR), (2)
98 any delays (e.g., newline) specified in the entry will be set in the
99 tty driver, (3) tabs expansion will be turned on or off according to
100 the specification in the entry, and (4) if tabs are not expanded,
101 standard tabs will be set (every 8 spaces).  If an entry does not
102 contain the information needed for any of the four above activities,
103 that activity will silently be skipped.
104 .TP
105 \fBreset\fR
106 Instead of putting out initialization strings, the terminal's
107 reset strings will be output if present (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR, \fBrf\fR).
108 If the reset strings are not present, but initialization
109 strings are, the initialization strings will be output.
110 Otherwise, \fBreset\fR acts identically to \fBinit\fR.
111 .TP
112 \fBlongname\fR
113 If the \fBterminfo\fR database is present and an entry for the
114 user's terminal exists (see \fB-T\fR\fItype\fR above), then the long name
115 of the terminal will be put out.  The long name is the last
116 name in the first line of the terminal's description in the
117 \fBterminfo\fR database [see \fBterm\fR(5)].
118 .PP
119 If \fBtput\fR is invoked by a link named \fBreset\fR, this has the
120 same effect as \fBtput reset\fR.
121 See \fBtset\fR for comparison, which has similar behavior.
122 .SH EXAMPLES
123 .TP 5
124 \fBtput init\fR
125 Initialize the terminal according to the type of
126 terminal in the environmental variable \fBTERM\fR.  This
127 command should be included in everyone's .profile after
128 the environmental variable \fBTERM\fR has been exported, as
129 illustrated on the \fBprofile\fR(4) manual page.
130 .TP 5
131 \fBtput -T5620 reset\fR
132 Reset an AT&T 5620 terminal, overriding the type of
133 terminal in the environmental variable \fBTERM\fR.
134 .TP 5
135 \fBtput cup 0 0\fR
136 Send the sequence to move the cursor to row \fB0\fR, column \fB0\fR
137 (the upper left corner of the screen, usually known as the "home"
138 cursor position).
139 .TP 5
140 \fBtput clear\fR
141 Echo the clear-screen sequence for the current terminal.
142 .TP 5
143 \fBtput cols\fR
144 Print the number of columns for the current terminal.
145 .TP 5
146 \fBtput -T450 cols\fR
147 Print the number of columns for the 450 terminal.
148 .TP 5
149 \fBbold=`tput smso` offbold=`tput rmso`\fR
150 Set the shell variables \fBbold\fR, to begin stand-out mode
151 sequence, and \fBoffbold\fR, to end standout mode sequence,
152 for the current terminal.  This might be followed by a
153 prompt: \fBecho "${bold}Please type in your name: ${offbold}\\c"\fR
154 .TP 5
155 \fBtput hc\fR
156 Set exit code to indicate if the current terminal is a hard copy terminal.
157 .TP 5
158 \fBtput cup 23 4\fR
159 Send the sequence to move the cursor to row 23, column 4.
160 .TP 5
161 \fBtput longname\fR
162 Print the long name from the \fBterminfo\fR database for the
163 type of terminal specified in the environmental
164 variable \fBTERM\fR.
165 .PP
166 .RS 5
167 \fBtput -S <<!\fR
168 .br
169 \fB> clear\fR
170 .br
171 \fB> cup 10 10\fR
172 .br
173 \fB> bold\fR
174 .br
175 \fB> !\fR
176 .RE
177 .TP 5
178 \&
179 This example shows tput processing several capabilities in one
180 invocation.  This example clears the screen, moves the cursor to
181 position 10, 10 and turns on bold (extra bright) mode.  The list is
182 terminated by an exclamation mark (\fB!\fR) on a line by itself.
183 .SH FILES
184 .TP
185 \fB\*d\fR
186 compiled terminal description database
187 .TP
188 \fB/usr/include/curses.h\fR
189 \fBcurses\fR(3X) header file
190 .TP
191 \fB/usr/include/term.h\fR
192 \fBterminfo\fR header file
193 .TP
194 \fB@DATADIR@/tabset/*\fR
195 tab settings for some terminals, in a format
196 appropriate to be output to the terminal (escape
197 sequences that set margins and tabs); for more
198 information, see the "Tabs and Initialization"
199 section of \fBterminfo\fR(4)
200 .SH SEE ALSO
201 \fB@CLEAR@\fR(1), \fBstty\fR(1), \fBtabs\fR(\*n).  \fBprofile\fR(\*n),
202 \fBterminfo\fR(4) in the \fISystem\fR \fIAdministrator\fR'\fIs\fR
203 \fIReference\fR \fIManual\fR.  Chapter 10 of the
204 \fIProgrammer\fR'\fIs\fR \fIGuide\fR.
205 .SH EXIT CODES
206 If \fIcapname\fR is of type boolean, a value of \fB0\fR is set for
207 TRUE and \fB1\fR for FALSE unless the \fB-S\fR option is used.
208 .PP
209 If \fIcapname\fR is of type string, a value of \fB0\fR is set if the
210 \fIcapname\fR is defined for this terminal \fItype\fR (the value of
211 \fIcapname\fR is returned on standard output); a value of \fB1\fR is
212 set if \fIcapname\fR is not defined for this terminal \fItype\fR (a
213 null value is returned on standard output).
214 .PP
215 If \fIcapname\fR is of type boolean or string and the \fB-S\fR option
216 is used, a value of \fB0\fR is returned to indicate that all lines
217 were successful.  No indication of which line failed can be given so
218 exit code \fB1\fR will never appear.  Exit codes \fB2\fR, \fB3\fR, and
219 \fB4\fR retain their usual interpretation.
220 .PP
221 If \fIcapname\fR is of type integer, a value of \fB0\fR is always set,
222 whether or not \fIcapname\fR is defined for this terminal \fItype\fR.
223 To determine if \fIcapname\fR is defined for this terminal \fItype\fR,
224 the user must test the value of standard output.  A value of \fB-1\fR
225 means that \fIcapname\fR is not defined for this terminal \fItype\fR.
226 .PP
227 Any other exit code indicates an error; see the DIAGNOSTICS section.
228 .SH DIAGNOSTICS
229 \fBtput\fR prints the following error messages and sets the corresponding exit
230 codes.
231 .PP
232 .TS
233 l l.
234 exit code       error message
235 =
236 \fB0\fR T{
237 (\fIcapname\fR is a numeric variable that is not specified in the
238 \fBterminfo\fR(\*n) database for this terminal type, e.g.
239 \fBtput -T450 lines\fR and \fBtput -T2621 xmc\fR)
240 T}
241 \fB1\fR no error message is printed, see the \fBEXIT CODES\fR section.
242 \fB2\fR usage error
243 \fB3\fR unknown terminal \fItype\fR or no \fBterminfo\fR database
244 \fB4\fR unknown \fBterminfo\fR capability \fIcapname\fR
245 =
246 .TE
247 .SH PORTABILITY
248 The \fBlongname\fR and \fB-S\fR options, and the parameter-substitution
249 features used in the \fBcup\fR example, are not supported in BSD curses or in
250 AT&T/USL curses before SVr4.
251 .\"#
252 .\"# The following sets edit modes for GNU EMACS
253 .\"# Local Variables:
254 .\"# mode:nroff
255 .\"# fill-column:79
256 .\"# End: