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