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