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