]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tput.1
ncurses 6.4 - patch 20231230
[ncurses.git] / man / tput.1
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright 2018-2022,2023 Thomas E. Dickey                                *
4 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
5 .\"                                                                          *
6 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
7 .\" copy of this software and associated documentation files (the            *
8 .\" "Software"), to deal in the Software without restriction, including      *
9 .\" without limitation the rights to use, copy, modify, merge, publish,      *
10 .\" distribute, distribute with modifications, sublicense, and/or sell       *
11 .\" copies of the Software, and to permit persons to whom the Software is    *
12 .\" furnished to do so, subject to the following conditions:                 *
13 .\"                                                                          *
14 .\" The above copyright notice and this permission notice shall be included  *
15 .\" in all copies or substantial portions of the Software.                   *
16 .\"                                                                          *
17 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24 .\"                                                                          *
25 .\" Except as contained in this notice, the name(s) of the above copyright   *
26 .\" holders shall not be used in advertising or otherwise to promote the     *
27 .\" sale, use or other dealings in this Software without prior written       *
28 .\" authorization.                                                           *
29 .\"***************************************************************************
30 .\"
31 .\" $Id: tput.1,v 1.97 2023/12/31 00:16:41 tom Exp $
32 .TH @TPUT@ 1 2023-12-30 "ncurses 6.4" "User commands"
33 .ie \n(.g \{\
34 .ds `` \(lq
35 .ds '' \(rq
36 .\}
37 .el \{\
38 .ie t .ds `` ``
39 .el   .ds `` ""
40 .ie t .ds '' ''
41 .el   .ds '' ""
42 .\}
43 .
44 .de bP
45 .ie n  .IP \(bu 4
46 .el    .IP \(bu 2
47 ..
48 .ds d @TERMINFO@
49 .SH NAME
50 \fB\%@TPUT@\fP,
51 \fB\%reset\fP \-
52 initialize a terminal or query \fI\%term\%info\fP database
53 .SH SYNOPSIS
54 \fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP]
55 {\fIcap-code\fP [\fIparameter\fP .\|.\|.\&]} .\|.\|.
56 .PP
57 \fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] [\fB\-x\fP] \fBclear\fP
58 .PP
59 \fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fBinit\fP
60 .PP
61 \fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fBreset\fP
62 .PP
63 \fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fBlongname\fP
64 .PP
65 \fB@TPUT@ \-S\fP
66 .PP
67 \fB@TPUT@ \-V\fP
68 .SH DESCRIPTION
69 \fB@TPUT@\fP uses the \fI\%term\%info\fP library and database to make
70 the values of terminal-specific capabilities and information available
71 to the shell,
72 to initialize or reset the terminal,
73 or report the long name of the current
74 (or specified)
75 terminal type.
76 When retrieving capability values,
77 the result depends upon the capability's type.
78 .TP 9 \" "Boolean" + 2n
79 Boolean
80 \fB@TPUT@\fP sets its exit status to
81 .B 0
82 if the terminal possesses
83 .I cap-code,
84 and
85 .B 1
86 if it does not.
87 .TP
88 integer
89 \fB@TPUT@\fP writes
90 .IR cap-code 's
91 decimal value to the standard output stream if defined
92 .RB ( \-1
93 if it is not)
94 followed by a newline.
95 .TP
96 string
97 \fB@TPUT@\fP writes
98 .IR cap-code 's
99 value to the standard output stream if defined,
100 without a trailing newline.
101 .PP
102 Before using a value returned on the standard output,
103 the application should test \fB@TPUT@\fP's exit status
104 (for example,
105 using \fB$?\fP in \fIsh\fP(1))
106 to be sure it is \fB0\fP;
107 see sections \*(``EXIT STATUS\*('' and \*(``DIAGNOSTICS\*('' below.
108 For a complete list of
109 .I cap-codes,
110 see \fB\%terminfo\fP(5).
111 .SS Options
112 .TP
113 \fB\-S\fP
114 allows more than one capability per invocation of \fB@TPUT@\fP.
115 The capabilities must be passed to \fB@TPUT@\fP from the standard input
116 instead of from the command line
117 (see example).
118 Only one \fIcap-code\fP is allowed per line.
119 The \fB\-S\fP option changes the
120 meaning of the \fB0\fP and \fB1\fP Boolean and string exit statuses
121 (see section \*(``EXIT STATUS\*('' below).
122 .IP
123 Because some capabilities may use
124 \fIstring\fP parameters rather than \fInumbers\fP,
125 \fB@TPUT@\fP uses a table and the presence of parameters in its input
126 to decide whether to use \fBtparm\fP(3X),
127 and how to interpret the parameters.
128 .TP
129 \fB\-T\fItype\fR
130 indicates the \fItype\fP of terminal.
131 Normally this option is
132 unnecessary, because the default is taken from the environment
133 variable \fITERM\fP.
134 If \fB\-T\fP is specified, then the shell
135 variables \fILINES\fP and \fI\%COLUMNS\fP will also be ignored.
136 .TP
137 \fB\-V\fP
138 reports the version of \fI\%ncurses\fP which was used in this program,
139 and exits.
140 .TP
141 .B \-x
142 prevents \fB\%@TPUT@\fP from attempting to clear the scrollback buffer.
143 .SS Commands
144 A few commands (\fBinit\fP, \fBreset\fP and \fBlongname\fP) are
145 special; they are defined by the \fB@TPUT@\fP program.
146 The others are the names of \fIcapabilities\fP from the terminal database
147 (see \fB\%terminfo\fP(5) for a list).
148 Although \fBinit\fP and \fBreset\fP resemble capability names,
149 \fB@TPUT@\fP uses several capabilities to perform these special functions.
150 .TP
151 \fIcap-code\fP
152 indicates the capability from the terminal database.
153 .IP
154 If the capability is a string that takes parameters, the arguments
155 following the capability will be used as parameters for the string.
156 .IP
157 Most parameters are numbers.
158 Only a few terminal capabilities require string parameters;
159 \fB@TPUT@\fP uses a table to decide which to pass as strings.
160 Normally \fB@TPUT@\fP uses \fBtparm\fP(3X) to perform the substitution.
161 If no parameters are given for the capability,
162 \fB@TPUT@\fP writes the string without performing the substitution.
163 .TP
164 \fBinit\fP
165 If the terminal database is present and an entry for the user's
166 terminal exists (see \fB\-T\fItype\fR, above), the following will
167 occur:
168 .RS
169 .TP 5
170 (1)
171 first, \fB@TPUT@\fP retrieves the current terminal mode settings
172 for your terminal.
173 It does this by successively testing
174 .RS
175 .bP
176 the standard error,
177 .bP
178 standard output,
179 .bP
180 standard input and
181 .bP
182 ultimately \*(``/dev/tty\*(''
183 .RE
184 .IP
185 to obtain terminal settings.
186 Having retrieved these settings, \fB@TPUT@\fP remembers which
187 file descriptor to use when updating settings.
188 .TP
189 (2)
190 if the window size cannot be obtained from the operating system,
191 but the terminal description
192 (or environment,
193 e.g.,
194 \fILINES\fP and \fI\%COLUMNS\fP variables specify this),
195 update the operating system's notion of the window size.
196 .TP
197 (3)
198 the terminal modes will be updated:
199 .RS
200 .bP
201 any delays (e.g., newline) specified in the entry will
202 be set in the tty driver,
203 .bP
204 tabs expansion will be turned on or off according to
205 the specification in the entry, and
206 .bP
207 if tabs are not expanded,
208 standard tabs will be set (every 8 spaces).
209 .RE
210 .TP
211 (4)
212 if present, the terminal's initialization strings will be
213 output as detailed in the \fB\%terminfo\fP(5) section on
214 .IR "Tabs and Initialization" ,
215 .TP
216 (5)
217 output is flushed.
218 .RE
219 .IP
220 If an entry does not
221 contain the information needed for any of these activities,
222 that activity will silently be skipped.
223 .TP
224 \fBreset\fP
225 This is similar to \fBinit\fP, with two differences:
226 .RS
227 .TP 5
228 (1)
229 before any other initialization,
230 the terminal modes will be reset to a \*(``sane\*('' state:
231 .RS
232 .bP
233 set cooked and echo modes,
234 .bP
235 turn off cbreak and raw modes,
236 .bP
237 turn on newline translation and
238 .bP
239 reset any unset special characters to their default values
240 .RE
241 .TP 5
242 (2)
243 Instead of putting out \fIinitialization\fP strings, the terminal's
244 \fIreset\fP strings will be output if present
245 (\fBrs1\fP, \fBrs2\fP, \fBrs3\fP, \fBrf\fP).
246 If the \fIreset\fP strings are not present, but \fIinitialization\fP
247 strings are, the \fIinitialization\fP strings will be output.
248 .RE
249 .IP
250 Otherwise, \fBreset\fP acts identically to \fBinit\fP.
251 .TP
252 .B longname
253 A terminfo entry begins with one or more names by which an
254 application can refer to the entry,
255 before the list of terminal capabilities.
256 The names are separated by \*(``|\*('' characters.
257 X/Open states that the last name is the \*(``long name\*(''
258 and also that it may include blanks.
259 .IP
260 \fB\%@TIC@\fP warns if the last name does not include blanks,
261 to accommodate old terminfo entries which treated
262 the long name as an optional feature.
263 The long name is often referred to as the description field.
264 .IP
265 If the terminal database is present and an entry for the user's terminal
266 exists
267 (see
268 .B \-T
269 .I type
270 above),
271 \fB\%@TPUT@\fP reports the terminal's description
272 (or \*(``long name\*('')
273 to the standard output,
274 without a trailing newline.
275 See \fB\%term\%info\fP(5).
276 .SS Aliases
277 \fB@TPUT@\fP handles the \fBclear\fP, \fBinit\fP and \fBreset\fP
278 commands specially:
279 it allows for the possibility that it is invoked by a link with those names.
280 .PP
281 If \fB@TPUT@\fP is invoked by a link named \fBreset\fP, this has the
282 same effect as \fB@TPUT@ reset\fP.
283 The \fB@TSET@\fP(1) utility also treats a link named \fBreset\fP specially.
284 .PP
285 Before \fI\%ncurses\fP 6.1,
286 the two utilities were different from each other:
287 .bP
288 \fB@TSET@\fP utility reset the terminal modes and special characters
289 (not done with \fB@TPUT@\fP).
290 .bP
291 On the other hand, \fB@TSET@\fP's repertoire of terminal capabilities for
292 resetting the terminal was more limited,
293 i.e., only \fBreset_1string\fP, \fBreset_2string\fP and \fBreset_file\fP
294 in contrast to the tab-stops and margins which are set by this utility.
295 .bP
296 The \fBreset\fP program is usually an alias for \fB@TSET@\fP,
297 because of this difference with resetting terminal modes and special characters.
298 .PP
299 With the changes made for \fI\%ncurses\fP 6.1,
300 the \fIreset\fP feature of the two programs is (mostly) the same.
301 A few differences remain:
302 .bP
303 The \fB@TSET@\fP program waits one second when resetting,
304 in case it happens to be a hardware terminal.
305 .bP
306 The two programs write the terminal initialization strings
307 to different streams (i.e., the standard error for \fB@TSET@\fP and the
308 standard output for \fB@TPUT@\fP).
309 .IP
310 \fBNote:\fP although these programs write to different streams,
311 redirecting their output to a file will capture only part of their actions.
312 The changes to the terminal modes are not affected by redirecting the output.
313 .PP
314 If \fB@TPUT@\fP is invoked by a link named \fBinit\fP, this has the
315 same effect as \fB@TPUT@ init\fP.
316 Again, you are less likely to use that link because another program
317 named \fBinit\fP has a more well-established use.
318 .SS "Terminal Size"
319 Besides the special commands (e.g., \fBclear\fP),
320 @TPUT@ treats certain terminfo capabilities specially:
321 \fBlines\fP and \fBcols\fP.
322 @TPUT@ calls \fBsetupterm\fP(3X) to obtain the terminal size:
323 .bP
324 first, it gets the size from the terminal database
325 (which generally is not provided for terminal emulators
326 which do not have a fixed window size)
327 .bP
328 then it asks the operating system for the terminal's size
329 (which generally works, unless connecting via a serial line which
330 does not support \fINAWS\fP: negotiations about window size).
331 .bP
332 finally, it inspects the environment variables \fILINES\fP and
333 \fI\%COLUMNS\fP which may override the terminal size.
334 .PP
335 If the \fB\-T\fP option is given
336 @TPUT@ ignores the environment variables by calling \fBuse_tioctl(TRUE)\fP,
337 relying upon the operating system (or finally, the terminal database).
338 .SH EXIT STATUS
339 If the \fB\-S\fP option is used,
340 \fB@TPUT@\fP checks for errors from each line,
341 and if any errors are found, will set the exit status to 4 plus the
342 number of lines with errors.
343 If no errors are found, the exit status is \fB0\fP.
344 No indication of which line failed can be given so
345 exit status \fB1\fP will never appear.
346 Exit statuses \fB2\fP, \fB3\fP, and
347 \fB4\fP retain their usual interpretation.
348 If the \fB\-S\fP option is not used,
349 the exit status depends on the type of \fIcap-code\fP:
350 .RS 3
351 .TP
352 .I Boolean
353 a value of \fB0\fP is set for TRUE and \fB1\fP for FALSE.
354 .TP
355 .I string
356 a value of \fB0\fP is set if the
357 \fIcap-code\fP is defined for this terminal \fItype\fP (the value of
358 \fIcap-code\fP is returned on standard output);
359 a value of \fB1\fP is set if \fIcap-code\fP
360 is not defined for this terminal \fItype\fP
361 (nothing is written to standard output).
362 .TP
363 .I integer
364 a value of \fB0\fP is always set,
365 whether or not \fIcap-code\fP is defined for this terminal \fItype\fP.
366 To determine if \fIcap-code\fP is defined for this terminal \fItype\fP,
367 the user must test the value written to standard output.
368 A value of \fB\-1\fP
369 means that \fIcap-code\fP is not defined for this terminal \fItype\fP.
370 .TP
371 .I other
372 \fBreset\fP or \fBinit\fP may fail to find their respective files.
373 In that case, the exit status is set to 4 + \fBerrno\fP.
374 .RE
375 .PP
376 Any other exit status indicates an error;
377 see section \*(``DIAGNOSTICS\*('' below.
378 .SH DIAGNOSTICS
379 \fB@TPUT@\fP prints the following error messages and sets the
380 corresponding exit statuses.
381 .PP
382 .ne 15
383 .TS
384 l l.
385 exit status     error message
386 =
387 \fB0\fP T{
388 (\fIcap-code\fP is a numeric variable that is not specified in the
389 \fB\%terminfo\fP(5) database for this terminal type, e.g.
390 \fB@TPUT@ \-T450 lines\fP and \fB@TPUT@ \-Thp2621 xmc\fP)
391 T}
392 \fB1\fP no error message is printed, see the \fBEXIT STATUS\fP section.
393 \fB2\fP usage error
394 \fB3\fP unknown terminal \fItype\fP or no \fI\%term\%info\fP database
395 \fB4\fP unknown \fI\%term\%info\fP capability \fIcap-code\fP
396 \fB>4\fP        error occurred in \-S
397 =
398 .TE
399 .SH FILES
400 .TP
401 .I @DATADIR@/tabset
402 tab stop initialization database
403 .TP
404 .I \*d
405 compiled terminal description database
406 .SH PORTABILITY
407 This implementation of \fBtput\fP differs from AT&T \fBtput\fP in
408 two important areas:
409 .bP
410 \fB@TPUT@\fP \fIcap-code\fP writes to the standard output.
411 That need not be a regular terminal.
412 However, the subcommands which manipulate terminal modes
413 may not use the standard output.
414 .IP
415 The AT&T implementation's \fBinit\fP and \fBreset\fP commands
416 use the BSD (4.1c) \fBtset\fP source, which manipulates terminal modes.
417 It successively tries standard output, standard error, standard input
418 before falling back to \*(``/dev/tty\*('' and finally just assumes
419 a 1200Bd terminal.
420 When updating terminal modes, it ignores errors.
421 .IP
422 Until changes made after \fI\%ncurses\fP 6.0,
423 \fB@TPUT@\fP did not modify terminal modes.
424 \fB@TPUT@\fP now uses a similar scheme,
425 using functions shared with \fB@TSET@\fP
426 (and ultimately based on the 4.4BSD \fBtset\fP).
427 If it is not able to open a terminal, e.g., when running in \fBcron\fP(1),
428 \fB@TPUT@\fP will return an error.
429 .bP
430 AT&T \fBtput\fP guesses the type of its \fIcap-code\fP operands by
431 seeing if all of the characters are numeric,
432 or not.
433 .IP
434 Most implementations which provide support for \fIcap-code\fP operands
435 use the \fBtparm\fP function to expand parameters in it.
436 That function expects a mixture of numeric and string parameters,
437 requiring \fB@TPUT@\fP to know which type to use.
438 .IP
439 This implementation uses a table to determine the parameter types for
440 the standard \fIcap-code\fP operands, and an internal library
441 function to analyze nonstandard \fIcap-code\fP operands.
442 .IP
443 Besides providing more reliable operation than AT&T's utility,
444 a portability problem is introduced by this analysis:
445 An OpenBSD developer adapted the internal library function from
446 \fI\%ncurses\fP to port NetBSD's termcap-based \fBtput\fP to terminfo.
447 That had been modified to interpret multiple commands on a line.
448 Portable applications should not rely upon this feature;
449 \fI\%ncurses\fP provides it to support applications written
450 specifically for OpenBSD.
451 .PP
452 This implementation (unlike others) can accept both \fItermcap\fP
453 and \fIterminfo\fP names for the \fIcap-code\fP feature,
454 if
455 \fItermcap\fP support is compiled in.
456 However, the predefined \fItermcap\fP and \fIterminfo\fP names have two
457 ambiguities in this case (and the \fIterminfo\fP name is assumed):
458 .bP
459 The \fItermcap\fP name \fBdl\fP corresponds to
460 the \fIterminfo\fP name \fBdl1\fP (delete one line).
461 .br
462 The \fIterminfo\fP name \fBdl\fP corresponds to
463 the \fItermcap\fP name \fBDL\fP (delete a given number of lines).
464 .bP
465 The \fItermcap\fP name \fBed\fP corresponds to
466 the \fIterminfo\fP name \fBrmdc\fP (end delete mode).
467 .br
468 The \fIterminfo\fP name \fBed\fP corresponds to
469 the \fItermcap\fP name \fBcd\fP (clear to end of screen).
470 .PP
471 The \fBlongname\fP and \fB\-S\fP options, and the parameter-substitution
472 features used in the \fBcup\fP example,
473 were not supported in
474 AT&T/USL
475 .I curses
476 before SVr4 (1989).
477 Later, 4.3BSD-Reno (1990) added support for \fBlongname\fP,
478 .\" longname was added in October 1989.
479 and NetBSD (1994) added support for the parameter-substitution features.
480 .PP
481 IEEE Std 1003.1/The Open Group  Base Specifications Issue 7 (POSIX.1-2008)
482 documents only the operands for \fBclear\fP, \fBinit\fP and \fBreset\fP.
483 There are a few interesting observations to make regarding that:
484 .bP
485 In this implementation,
486 \fBclear\fP is part of the \fIcap-code\fP support.
487 The others (\fBinit\fP and \fBlongname\fP) do not correspond to terminal
488 capabilities.
489 .bP
490 Other implementations of \fBtput\fP on
491 SVr4-based systems such as Solaris, IRIX64 and HP-UX
492 as well as others such as AIX and Tru64
493 provide support for \fIcap-code\fP operands.
494 .bP
495 A few platforms such as FreeBSD recognize termcap names rather
496 than terminfo capability names in their respective \fBtput\fP commands.
497 Since 2010, NetBSD's \fBtput\fP uses terminfo names.
498 Before that, it (like FreeBSD) recognized termcap names.
499 .IP
500 Beginning in 2021, FreeBSD uses the \fI\%ncurses\fP \fBtput\fP,
501 configured for both terminfo (tested first) and termcap (as a fallback).
502 .PP
503 Because (apparently) \fIall\fP of the certified Unix systems
504 support the full set of capability names, the reasoning for documenting
505 only a few may not be apparent.
506 .bP
507 X/Open Curses Issue 7 documents \fBtput\fP differently,
508 with \fIcap-code\fP and the other features used in this implementation.
509 .bP
510 That is, there are two standards for \fBtput\fP:
511 POSIX (a subset) and X/Open Curses (the full implementation).
512 POSIX documents a subset to avoid the complication of including X/Open Curses
513 and the terminal capabilities database.
514 .bP
515 While it is certainly possible to write a \fBtput\fP program
516 without using
517 .I curses,
518 no system with a
519 .I curses
520 implementation provides a \fBtput\fP utility that does not also supply
521 the \fIcap-code\fP feature.
522 .PP
523 X/Open Curses Issue 7 (2009) is the first version to document utilities.
524 However that part of X/Open Curses does not follow existing practice
525 (that is,
526 System\ V
527 .I curses
528 behavior).
529 .bP
530 It assigns exit status 4 to \*(``invalid operand\*('',
531 which may be the same as \fIunknown capability\fP.
532 For instance, the source code for Solaris' xcurses uses the term
533 \*(``invalid\*('' in this case.
534 .bP
535 It assigns exit status 255 to a numeric variable that is not specified in
536 the terminfo database.
537 That likely is a documentation error,
538 confusing the \fB\-1\fP written to the standard output for an absent
539 or cancelled numeric value versus an (unsigned) exit status.
540 .PP
541 The various Unix systems (AIX, HP-UX, Solaris) use the same exit statuses
542 as \fI\%ncurses\fP.
543 .PP
544 NetBSD curses documents different exit statuses which do not correspond
545 to either \fI\%ncurses\fP or X/Open.
546 .SH HISTORY
547 The \fBtput\fP command was begun by Bill Joy in 1980.
548 The initial version only cleared the screen.
549 .PP
550 AT&T System V provided a different \fBtput\fP command:
551 .bP
552 SVr2 provided a rudimentary \fBtput\fP
553 which checked the parameter against each
554 predefined capability and returned the corresponding value.
555 This version of \fBtput\fP did not use \fBtparm\fP(3X) for
556 the capabilities which are parameterized.
557 .bP
558 SVr3 replaced that, a year later, by a more extensive program
559 whose \fBinit\fP and \fBreset\fP subcommands
560 (more than half the program) were incorporated from
561 the \fBreset\fP feature of BSD \fBtset\fP written by Eric Allman.
562 .bP
563 SVr4 added color initialization using the \fBorig_colors\fP and
564 \fBorig_pair\fP capabilities in the \fBinit\fP subcommand.
565 .PP
566 Keith Bostic replaced the BSD \fBtput\fP command in 1989
567 with a new implementation
568 based on the AT&T System V program \fBtput\fP.
569 Like the AT&T program, Bostic's version
570 accepted some parameters named for \fIterminfo\fP capabilities
571 (\fBclear\fP, \fBinit\fP, \fBlongname\fP and \fBreset\fP).
572 However (because he had only \fItermcap\fP available),
573 it accepted \fItermcap\fP names for other capabilities.
574 Also, Bostic's BSD \fBtput\fP did not modify the terminal I/O modes
575 as the earlier BSD \fBtset\fP had done.
576 .PP
577 At the same time, Bostic added a shell script named \*(``clear\*('',
578 which used \fBtput\fP to clear the screen.
579 .PP
580 Both of these appeared in 4.4BSD,
581 becoming the \*(``modern\*('' BSD implementation of \fBtput\fP.
582 .PP
583 This implementation of \fBtput\fP began from a different source than
584 AT&T or BSD: Ross Ridge's \fImytinfo\fP package, published on
585 \fIcomp.sources.unix\fP in December 1992.
586 Ridge's program made more sophisticated use of the terminal capabilities
587 than the BSD program.
588 Eric Raymond used that \fBtput\fP program
589 (and other parts of \fImytinfo\fP) in \fI\%ncurses\fP in June 1995.
590 Using the portions dealing with terminal capabilities
591 almost without change,
592 Raymond made improvements to the way the command-line parameters
593 were handled.
594 .SH EXAMPLES
595 .TP 5
596 \fB@TPUT@ init\fP
597 Initialize the terminal according to the type of
598 terminal in the environment variable \fITERM\fP.
599 This command should be included in everyone's .profile after
600 the environment variable \fITERM\fP has been exported,
601 as illustrated on the \fBprofile\fP(5) manual page.
602 .TP 5
603 \fB@TPUT@ \-T5620 reset\fP
604 Reset an AT&T 5620 terminal, overriding the type of
605 terminal in the environment variable \fITERM\fP.
606 .TP 5
607 \fB@TPUT@ cup 0 0\fP
608 Send the sequence to move the cursor to row \fB0\fP, column \fB0\fP
609 (the upper left corner of the screen, usually known as the \*(``home\*(''
610 cursor position).
611 .TP 5
612 \fB@TPUT@ clear\fP
613 Echo the clear-screen sequence for the current terminal.
614 .TP 5
615 \fB@TPUT@ cols\fP
616 Print the number of columns for the current terminal.
617 .TP 5
618 \fB@TPUT@ \-T450 cols\fP
619 Print the number of columns for the 450 terminal.
620 .TP 5
621 \fBbold=\(ga@TPUT@ smso\(ga offbold=\(ga@TPUT@ rmso\(ga\fP
622 Set the shell variables \fBbold\fP, to begin stand-out mode
623 sequence, and \fBoffbold\fP, to end standout mode sequence,
624 for the current terminal.
625 This might be followed by a
626 prompt: \fBecho "${bold}Please type in your name: ${offbold}\ec"\fP
627 .TP 5
628 \fB@TPUT@ hc\fP
629 Set exit status to indicate if the current terminal is a hard copy terminal.
630 .TP 5
631 \fB@TPUT@ cup 23 4\fP
632 Send the sequence to move the cursor to row 23, column 4.
633 .TP 5
634 \fB@TPUT@ cup\fP
635 Send the terminfo string for cursor-movement, with no parameters substituted.
636 .TP 5
637 \fB@TPUT@ longname\fP
638 Print the long name from the \fI\%term\%info\fP database for the
639 type of terminal specified in the environment
640 variable \fITERM\fP.
641 .TP 5
642 \fB@TPUT@ \-S\fP
643 The \fB\-S\fP option can be profitably used with a shell
644 \*(``here document\*(''.
645 .IP
646 .EX
647 $ \fB@TPUT@ \-S <<!\fP
648 > \fBclear\fP
649 > \fBcup 10 10\fP
650 > \fBbold\fP
651 > \fB!\fP
652 .EE
653 .IP
654 We see \fB@TPUT@\fP processing several capabilities in one invocation.
655 It clears the screen,
656 moves the cursor to position
657 (10, 10)
658 and turns on bold
659 (extra bright)
660 mode.
661 .TP 5
662 .B @TPUT@ clear cup 10 10 bold
663 Perform the same actions as the foregoing
664 .RB \%\[lq] @TPUT@
665 .BR \-S \[rq]
666 example.
667 .SH SEE ALSO
668 \fB\%@CLEAR@\fP(1),
669 \fB\%stty\fP(1),
670 \fB\%@TABS@\fP(1),
671 \fB\%@TSET@\fP(1),
672 \fB\%curs_termcap\fP(3X),
673 \fB\%terminfo\fP(5)