{
    "content": [
        {
            "type": "text",
            "text": "# tput (man)\n\n## NAME\n\ntput, reset - initialize a terminal or query terminfo database\n\n## SYNOPSIS\n\ntput [-Ttype] capname [parameters]\ntput [-Ttype] [-x] clear\ntput [-Ttype] init\ntput [-Ttype] reset\ntput [-Ttype] longname\n\n## DESCRIPTION\n\nThe tput utility uses the terminfo database to make the values of terminal-dependent capabil‐\nities and information available to the shell (see sh(1)), to initialize or reset  the  termi‐\nnal, or return the long name of the requested terminal type.  The result depends upon the ca‐\npability's type:\n\n## TLDR\n\n> View and modify terminal settings and capabilities.\n\n- Move the cursor to a screen location:\n  `tput cup {{row}} {{column}}`\n- Set foreground (af) or background (ab) color:\n  `tput {{setaf|setab}} {{ansi_color_code}}`\n- Reverse text and background colors:\n  `tput rev`\n- Reset all terminal text attributes:\n  `tput sgr0`\n- Show number of columns, lines, or colors:\n  `tput {{cols|lines|colors}}`\n- Enable or disable word wrap:\n  `tput {{smam|rmam}}`\n- Hide or show the terminal cursor:\n  `tput {{civis|cnorm}}`\n- Save or restore terminal text status (smcup also captures scroll wheel events):\n  `tput {{smcup|rmcup}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS** (2 subsections)\n- **DESCRIPTION** (9 subsections)\n- **EXAMPLES** (11 subsections)\n- **FILES** (1 subsections)\n- **EXIT CODES**\n- **DIAGNOSTICS**\n- **HISTORY**\n- **PORTABILITY**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "tput",
        "section": "",
        "mode": "man",
        "summary": "tput, reset - initialize a terminal or query terminfo database",
        "synopsis": "tput [-Ttype] capname [parameters]\ntput [-Ttype] [-x] clear\ntput [-Ttype] init\ntput [-Ttype] reset\ntput [-Ttype] longname",
        "tldr_summary": "View and modify terminal settings and capabilities.",
        "tldr_examples": [
            {
                "description": "Move the cursor to a screen location",
                "command": "tput cup {{row}} {{column}}"
            },
            {
                "description": "Set foreground (af) or background (ab) color",
                "command": "tput {{setaf|setab}} {{ansi_color_code}}"
            },
            {
                "description": "Reverse text and background colors",
                "command": "tput rev"
            },
            {
                "description": "Reset all terminal text attributes",
                "command": "tput sgr0"
            },
            {
                "description": "Show number of columns, lines, or colors",
                "command": "tput {{cols|lines|colors}}"
            },
            {
                "description": "Enable or disable word wrap",
                "command": "tput {{smam|rmam}}"
            },
            {
                "description": "Hide or show the terminal cursor",
                "command": "tput {{civis|cnorm}}"
            },
            {
                "description": "Save or restore terminal text status (smcup also captures scroll wheel events)",
                "command": "tput {{smcup|rmcup}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-S",
                "long": null,
                "arg": null,
                "description": "passed to tput from the standard input instead of from the command line (see example). Only one capname is allowed per line. The -S option changes the meaning of the 0 and 1 boolean and string exit codes (see the EXIT CODES section). Because some capabilities may use string parameters rather than numbers, tput uses a table and the presence of parameters in its input to decide whether to use tparm(3X), and how to interpret the parameters."
            },
            {
                "flag": "-T",
                "long": null,
                "arg": null,
                "description": "fault is taken from the environment variable TERM. If -T is specified, then the shell variables LINES and COLUMNS will also be ignored."
            },
            {
                "flag": "-V",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-x",
                "long": null,
                "arg": null,
                "description": "bility."
            }
        ],
        "examples": [
            "Initialize the terminal according to the type of terminal in the environmental  variable",
            "TERM.   This  command  should be included in everyone's .profile after the environmental",
            "variable TERM has been exported, as illustrated on the profile(5) manual page.",
            "Reset an AT&T 5620 terminal, overriding the type of terminal in the environmental  vari‐",
            "able TERM.",
            "Send  the  sequence  to move the cursor to row 0, column 0 (the upper left corner of the",
            "screen, usually known as the “home” cursor position).",
            "Echo the clear-screen sequence for the current terminal.",
            "Print the number of columns for the current terminal.",
            "Print the number of columns for the 450 terminal.",
            "Set the shell variables bold, to begin stand-out mode  sequence,  and  offbold,  to  end",
            "standout  mode  sequence, for the current terminal.  This might be followed by a prompt:",
            "echo \"${bold}Please type in your name: ${offbold}\\c\"",
            "Set exit code to indicate if the current terminal is a hard copy terminal.",
            "Send the sequence to move the cursor to row 23, column 4.",
            "Send the terminfo string for cursor-movement, with no parameters substituted.",
            "Print the long name from the terminfo database for the type of terminal specified in the",
            "environmental variable TERM.",
            "tput -S <<!",
            "> clear",
            "> cup 10 10",
            "> bold",
            "> !",
            "This  example  shows  tput processing several capabilities in one invocation.  It clears",
            "the screen, moves the cursor to position 10, 10 and turns on bold (extra  bright)  mode.",
            "The list is terminated by an exclamation mark (!) on a line by itself."
        ],
        "see_also": [
            {
                "name": "clear",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/clear/1/json"
            },
            {
                "name": "stty",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/stty/1/json"
            },
            {
                "name": "tabs",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/tabs/1/json"
            },
            {
                "name": "tset",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/tset/1/json"
            },
            {
                "name": "termcap",
                "section": "3NCURSES",
                "url": "https://www.chedong.com/phpMan.php/man/termcap/3NCURSES/json"
            },
            {
                "name": "terminfo",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/terminfo/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": [
                    {
                        "name": "tput -S  <<",
                        "lines": 1
                    },
                    {
                        "name": "tput -V",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 20,
                "subsections": [
                    {
                        "name": "Options",
                        "lines": 1
                    },
                    {
                        "name": "-S",
                        "lines": 8,
                        "flag": "-S"
                    },
                    {
                        "name": "-T",
                        "lines": 3,
                        "flag": "-T"
                    },
                    {
                        "name": "-V",
                        "lines": 1,
                        "flag": "-V"
                    },
                    {
                        "name": "-x",
                        "lines": 2,
                        "flag": "-x"
                    },
                    {
                        "name": "Commands",
                        "lines": 74
                    },
                    {
                        "name": "longname",
                        "lines": 5
                    },
                    {
                        "name": "Aliases",
                        "lines": 34
                    },
                    {
                        "name": "Terminal Size",
                        "lines": 16
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 1,
                "subsections": [
                    {
                        "name": "tput init",
                        "lines": 4
                    },
                    {
                        "name": "tput -T5620 reset",
                        "lines": 3
                    },
                    {
                        "name": "tput cup 0 0",
                        "lines": 3
                    },
                    {
                        "name": "tput clear",
                        "lines": 2
                    },
                    {
                        "name": "tput cols",
                        "lines": 2
                    },
                    {
                        "name": "tput -T450 cols",
                        "lines": 2
                    },
                    {
                        "name": "bold=`tput smso` offbold=`tput rmso`",
                        "lines": 4
                    },
                    {
                        "name": "tput hc",
                        "lines": 2
                    },
                    {
                        "name": "tput cup 23 4",
                        "lines": 2
                    },
                    {
                        "name": "tput cup",
                        "lines": 2
                    },
                    {
                        "name": "tput longname",
                        "lines": 13
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 1,
                "subsections": [
                    {
                        "name": "/etc/terminfo",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "EXIT CODES",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "PORTABILITY",
                "lines": 92,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "tput, reset - initialize a terminal or query terminfo database\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "tput [-Ttype] capname [parameters]\ntput [-Ttype] [-x] clear\ntput [-Ttype] init\ntput [-Ttype] reset\ntput [-Ttype] longname",
                "subsections": [
                    {
                        "name": "tput -S  <<",
                        "content": ""
                    },
                    {
                        "name": "tput -V",
                        "content": ""
                    }
                ]
            },
            "DESCRIPTION": {
                "content": "The tput utility uses the terminfo database to make the values of terminal-dependent capabil‐\nities and information available to the shell (see sh(1)), to initialize or reset  the  termi‐\nnal, or return the long name of the requested terminal type.  The result depends upon the ca‐\npability's type:\n\nstring\ntput writes the string to the standard output.  No trailing newline is supplied.\n\ninteger\ntput writes the decimal value to the standard output, with a trailing newline.\n\nboolean\ntput simply sets the exit code (0 for TRUE if the terminal has the capability, 1  for\nFALSE if it does not), and writes nothing to the standard output.\n\nBefore  using  a  value returned on the standard output, the application should test the exit\ncode (e.g., $?, see sh(1)) to be sure it is 0.  (See the  EXIT  CODES  and  DIAGNOSTICS  sec‐\ntions.)   For  a complete list of capabilities and the capname associated with each, see ter‐‐\nminfo(5).\n",
                "subsections": [
                    {
                        "name": "Options",
                        "content": ""
                    },
                    {
                        "name": "-S",
                        "content": "passed to tput from the standard input instead of from the command line (see example).\nOnly one capname is allowed per line.  The -S option changes the meaning of the 0  and\n1 boolean and string exit codes (see the EXIT CODES section).\n\nBecause  some  capabilities may use string parameters rather than numbers, tput uses a\ntable and the presence of parameters in its input to decide whether to use  tparm(3X),\nand how to interpret the parameters.\n",
                        "flag": "-S"
                    },
                    {
                        "name": "-T",
                        "content": "fault is taken from the environment variable TERM.  If -T is specified, then the shell\nvariables LINES and COLUMNS will also be ignored.\n",
                        "flag": "-T"
                    },
                    {
                        "name": "-V",
                        "content": "",
                        "flag": "-V"
                    },
                    {
                        "name": "-x",
                        "content": "bility.\n",
                        "flag": "-x"
                    },
                    {
                        "name": "Commands",
                        "content": "A few commands (init, reset and longname) are special; they are defined by the tput  program.\nThe  others  are  the names of capabilities from the terminal database (see terminfo(5) for a\nlist).  Although init and reset resemble capability names, tput uses several capabilities  to\nperform these special functions.\n\ncapname\nindicates the capability from the terminal database.\n\nIf the capability is a string that takes parameters, the arguments following the capa‐\nbility will be used as parameters for the string.\n\nMost parameters are numbers.  Only a few terminal capabilities require string  parame‐\nters;  tput  uses  a  table  to  decide  which to pass as strings.  Normally tput uses\ntparm(3X) to perform the substitution.  If no parameters are given for the capability,\ntput writes the string without performing the substitution.\n\ninit   If  the  terminal database is present and an entry for the user's terminal exists (see\n-Ttype, above), the following will occur:\n\n(1)  first, tput retrieves the current terminal mode settings for your  terminal.   It\ndoes this by successively testing\n\n•   the standard error,\n\n•   standard output,\n\n•   standard input and\n\n•   ultimately “/dev/tty”\n\nto  obtain  terminal  settings.   Having retrieved these settings, tput remembers\nwhich file descriptor to use when updating settings.\n\n(2)  if the window size cannot be obtained from the operating system, but the terminal\ndescription (or environment, e.g., LINES and COLUMNS variables specify this), up‐\ndate the operating system's notion of the window size.\n\n(3)  the terminal modes will be updated:\n\n•   any delays (e.g., newline) specified in the entry will  be  set  in  the  tty\ndriver,\n\n•   tabs expansion will be turned on or off according to the specification in the\nentry, and\n\n•   if tabs are not expanded, standard tabs will be set (every 8 spaces).\n\n(4)  if present, the terminal's initialization strings will be output as  detailed  in\nthe terminfo(5) section on Tabs and Initialization,\n\n(5)  output is flushed.\n\nIf  an entry does not contain the information needed for any of these activities, that\nactivity will silently be skipped.\n\nreset  This is similar to init, with two differences:\n\n(1)  before any other initialization, the terminal modes will be  reset  to  a  “sane”\nstate:\n\n•   set cooked and echo modes,\n\n•   turn off cbreak and raw modes,\n\n•   turn on newline translation and\n\n•   reset any unset special characters to their default values\n\n(2)  Instead  of putting out initialization strings, the terminal's reset strings will\nbe output if present (rs1, rs2, rs3, rf).  If the reset strings are not  present,\nbut initialization strings are, the initialization strings will be output.\n\nOtherwise, reset acts identically to init.\n"
                    },
                    {
                        "name": "longname",
                        "content": "If  the  terminal database is present and an entry for the user's terminal exists (see\n-Ttype above), then the long name of the terminal will be put out.  The long  name  is\nthe last name in the first line of the terminal's description in the terminfo database\n[see term(5)].\n"
                    },
                    {
                        "name": "Aliases",
                        "content": "tput handles the clear, init and reset commands specially: it allows for the possibility that\nit is invoked by a link with those names.\n\nIf  tput  is  invoked  by  a  link  named reset, this has the same effect as tput reset.  The\ntset(1) utility also treats a link named reset specially.\n\nBefore ncurses 6.1, the two utilities were different from each other:\n\n•   tset utility reset the terminal modes and special characters (not done with tput).\n\n•   On the other hand, tset's repertoire of terminal capabilities for resetting the  terminal\nwas  more  limited, i.e., only reset1string, reset2string and resetfile in contrast to\nthe tab-stops and margins which are set by this utility.\n\n•   The reset program is usually an alias for tset, because of this difference with resetting\nterminal modes and special characters.\n\nWith  the changes made for ncurses 6.1, the reset feature of the two programs is (mostly) the\nsame.  A few differences remain:\n\n•   The tset program waits one second when resetting, in case it happens  to  be  a  hardware\nterminal.\n\n•   The  two  programs  write the terminal initialization strings to different streams (i.e.,\nthe standard error for tset and the standard output for tput).\n\nNote: although these programs write to different streams, redirecting their output  to  a\nfile  will capture only part of their actions.  The changes to the terminal modes are not\naffected by redirecting the output.\n\nIf tput is invoked by a link named init, this has the same effect as tput init.   Again,  you\nare  less  likely  to use that link because another program named init has a more well-estab‐\nlished use.\n"
                    },
                    {
                        "name": "Terminal Size",
                        "content": "Besides the special commands (e.g., clear), tput treats certain  terminfo  capabilities  spe‐\ncially: lines and cols.  tput calls setupterm(3X) to obtain the terminal size:\n\n•   first,  it  gets the size from the terminal database (which generally is not provided for\nterminal emulators which do not have a fixed window size)\n\n•   then it asks the operating system for the terminal's size (which generally works,  unless\nconnecting  via  a  serial  line  which  does not support NAWS: negotiations about window\nsize).\n\n•   finally, it inspects the environment variables LINES and COLUMNS which may  override  the\nterminal size.\n\nIf the -T option is given tput ignores the environment variables by calling usetioctl(TRUE),\nrelying upon the operating system (or finally, the terminal database).\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "",
                "subsections": [
                    {
                        "name": "tput init",
                        "content": "Initialize the terminal according to the type of terminal in the environmental  variable\nTERM.   This  command  should be included in everyone's .profile after the environmental\nvariable TERM has been exported, as illustrated on the profile(5) manual page.\n"
                    },
                    {
                        "name": "tput -T5620 reset",
                        "content": "Reset an AT&T 5620 terminal, overriding the type of terminal in the environmental  vari‐\nable TERM.\n"
                    },
                    {
                        "name": "tput cup 0 0",
                        "content": "Send  the  sequence  to move the cursor to row 0, column 0 (the upper left corner of the\nscreen, usually known as the “home” cursor position).\n"
                    },
                    {
                        "name": "tput clear",
                        "content": "Echo the clear-screen sequence for the current terminal.\n"
                    },
                    {
                        "name": "tput cols",
                        "content": "Print the number of columns for the current terminal.\n"
                    },
                    {
                        "name": "tput -T450 cols",
                        "content": "Print the number of columns for the 450 terminal.\n"
                    },
                    {
                        "name": "bold=`tput smso` offbold=`tput rmso`",
                        "content": "Set the shell variables bold, to begin stand-out mode  sequence,  and  offbold,  to  end\nstandout  mode  sequence, for the current terminal.  This might be followed by a prompt:\necho \"${bold}Please type in your name: ${offbold}\\c\"\n"
                    },
                    {
                        "name": "tput hc",
                        "content": "Set exit code to indicate if the current terminal is a hard copy terminal.\n"
                    },
                    {
                        "name": "tput cup 23 4",
                        "content": "Send the sequence to move the cursor to row 23, column 4.\n"
                    },
                    {
                        "name": "tput cup",
                        "content": "Send the terminfo string for cursor-movement, with no parameters substituted.\n"
                    },
                    {
                        "name": "tput longname",
                        "content": "Print the long name from the terminfo database for the type of terminal specified in the\nenvironmental variable TERM.\n\ntput -S <<!\n> clear\n> cup 10 10\n> bold\n> !\n\nThis  example  shows  tput processing several capabilities in one invocation.  It clears\nthe screen, moves the cursor to position 10, 10 and turns on bold (extra  bright)  mode.\nThe list is terminated by an exclamation mark (!) on a line by itself.\n"
                    }
                ]
            },
            "FILES": {
                "content": "",
                "subsections": [
                    {
                        "name": "/etc/terminfo",
                        "content": "compiled terminal description database\n\n/usr/share/tabset/*\ntab  settings for some terminals, in a format appropriate to be output to the terminal\n(escape sequences that set margins and tabs); for more information, see the  Tabs  and\nInitialization, section of terminfo(5)\n"
                    }
                ]
            },
            "EXIT CODES": {
                "content": "If the -S option is used, tput checks for errors from each line, and if any errors are found,\nwill set the exit code to 4 plus the number of lines with errors.  If no  errors  are  found,\nthe  exit  code  is  0.   No indication of which line failed can be given so exit code 1 will\nnever appear.  Exit codes 2, 3, and 4 retain their usual interpretation.  If the -S option is\nnot used, the exit code depends on the type of capname:\n\nboolean\na value of 0 is set for TRUE and 1 for FALSE.\n\nstring a  value of 0 is set if the capname is defined for this terminal type (the value of\ncapname is returned on standard output); a value of 1 is set if capname is not  de‐\nfined for this terminal type (nothing is written to standard output).\n\ninteger\na  value  of  0  is always set, whether or not capname is defined for this terminal\ntype.  To determine if capname is defined for this terminal  type,  the  user  must\ntest the value written to standard output.  A value of -1 means that capname is not\ndefined for this terminal type.\n\nother  reset or init may fail to find their respective files.  In that case, the exit code\nis set to 4 + errno.\n\nAny other exit code indicates an error; see the DIAGNOSTICS section.\n",
                "subsections": []
            },
            "DIAGNOSTICS": {
                "content": "tput prints the following error messages and sets the corresponding exit codes.\n\nexit code   error message\n─────────────────────────────────────────────────────────────────────\n0           (capname  is a numeric variable that is not specified in\nthe terminfo(5) database for this  terminal  type,  e.g.\ntput -T450 lines and tput -Thp2621 xmc)\n1           no error message is printed, see the EXIT CODES section.\n2           usage error\n3           unknown terminal type or no terminfo database\n4           unknown terminfo capability capname\n>4          error occurred in -S\n─────────────────────────────────────────────────────────────────────\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "The tput command was begun by Bill Joy in 1980.  The initial version only cleared the screen.\n\nAT&T System V provided a different tput command:\n\n•   SVr2  provided a rudimentary tput which checked the parameter against each predefined ca‐\npability and returned the  corresponding  value.   This  version  of  tput  did  not  use\ntparm(3X) for the capabilities which are parameterized.\n\n•   SVr3  replaced  that, a year later, by a more extensive program whose init and reset sub‐\ncommands (more than half the program) were incorporated from the  reset  feature  of  BSD\ntset written by Eric Allman.\n\n•   SVr4  added color initialization using the origcolors and origpairs capabilities in the\ninit subcommand.\n\nKeith Bostic replaced the BSD tput command in 1989 with a new  implementation  based  on  the\nAT&T System V program tput.  Like the AT&T program, Bostic's version accepted some parameters\nnamed for terminfo capabilities (clear, init, longname and reset).  However (because  he  had\nonly  termcap  available),  it accepted termcap names for other capabilities.  Also, Bostic's\nBSD tput did not modify the terminal I/O modes as the earlier BSD tset had done.\n\nAt the same time, Bostic added a shell script named “clear”, which used  tput  to  clear  the\nscreen.\n\nBoth of these appeared in 4.4BSD, becoming the “modern” BSD implementation of tput.\n\nThis implementation of tput began from a different source than AT&T or BSD: Ross Ridge's myt‐\ninfo package, published on comp.sources.unix in December 1992.  Ridge's program made more so‐\nphisticated  use  of  the terminal capabilities than the BSD program.  Eric Raymond used that\ntput program (and other parts of mytinfo) in ncurses in June 1995.  Using the portions  deal‐\ning  with  terminal  capabilities almost without change, Raymond made improvements to the way\nthe command-line parameters were handled.\n",
                "subsections": []
            },
            "PORTABILITY": {
                "content": "This implementation of tput differs from AT&T tput in two important areas:\n\n•   tput capname writes to the standard output.  That need not be a regular  terminal.   How‐\never, the subcommands which manipulate terminal modes may not use the standard output.\n\nThe  AT&T  implementation's init and reset commands use the BSD (4.1c) tset source, which\nmanipulates terminal modes.  It successively tries standard output, standard error, stan‐\ndard  input before falling back to “/dev/tty” and finally just assumes a 1200Bd terminal.\nWhen updating terminal modes, it ignores errors.\n\nUntil changes made after ncurses 6.0, tput did not modify terminal modes.  tput now  uses\na  similar  scheme,  using functions shared with tset (and ultimately based on the 4.4BSD\ntset).  If it is not able to open a terminal, e.g., when running in cron, tput  will  re‐\nturn an error.\n\n•   AT&T tput guesses the type of its capname operands by seeing if all of the characters are\nnumeric, or not.\n\nMost implementations which provide support for capname operands use the tparm function to\nexpand  parameters  in it.  That function expects a mixture of numeric and string parame‐\nters, requiring tput to know which type to use.\n\nThis implementation uses a table to determine the parameter types for the  standard  cap‐\nname operands, and an internal library function to analyze nonstandard capname operands.\n\nBesides  providing  more reliable operation than AT&T's utility, a portability problem is\nintroduced by this analysis: An OpenBSD developer adapted the internal  library  function\nfrom  ncurses to port NetBSD's termcap-based tput to terminfo.  That had been modified to\ninterpret multiple commands on a line.  Portable applications should not rely  upon  this\nfeature; ncurses provides it to support applications written specifically for OpenBSD.\n\nThis  implementation  (unlike others) can accept both termcap and terminfo names for the cap‐\nname feature, if termcap support is compiled in.  However, the predefined  termcap  and  ter‐\nminfo names have two ambiguities in this case (and the terminfo name is assumed):\n\n•   The termcap name dl corresponds to the terminfo name dl1 (delete one line).\nThe terminfo name dl corresponds to the termcap name DL (delete a given number of lines).\n\n•   The termcap name ed corresponds to the terminfo name rmdc (end delete mode).\nThe terminfo name ed corresponds to the termcap name cd (clear to end of screen).\n\nThe longname and -S options, and the parameter-substitution features used in the cup example,\nwere not supported in BSD curses before 4.3reno (1989) or  in  AT&T/USL  curses  before  SVr4\n(1988).\n\nIEEE Std 1003.1/The Open Group  Base Specifications Issue 7 (POSIX.1-2008) documents only the\noperands for clear, init and reset.  There are a few interesting observations to make regard‐\ning that:\n\n•   In this implementation, clear is part of the capname support.  The others (init and long‐‐\nname) do not correspond to terminal capabilities.\n\n•   Other implementations of tput on SVr4-based systems such as Solaris, IRIX64 and  HPUX  as\nwell as others such as AIX and Tru64 provide support for capname operands.\n\n•   A  few  platforms such as FreeBSD recognize termcap names rather than terminfo capability\nnames in their respective tput commands.  Since 2010, NetBSD's tput uses terminfo  names.\nBefore that, it (like FreeBSD) recognized termcap names.\n\nBeginning  in  2021,  FreeBSD uses the ncurses tput, configured for both terminfo (tested\nfirst) and termcap (as a fallback).\n\nBecause (apparently) all of the certified Unix systems support the  full  set  of  capability\nnames, the reasoning for documenting only a few may not be apparent.\n\n•   X/Open  Curses  Issue  7  documents tput differently, with capname and the other features\nused in this implementation.\n\n•   That is, there are two standards for tput: POSIX (a subset) and X/Open Curses  (the  full\nimplementation).   POSIX documents a subset to avoid the complication of including X/Open\nCurses and the terminal capabilities database.\n\n•   While it is certainly possible to write a tput program without using curses, none of  the\nsystems  which have a curses implementation provide a tput utility which does not provide\nthe capname feature.\n\nX/Open Curses Issue 7 (2009) is the first version to document utilities.  However  that  part\nof  X/Open  Curses  does not follow existing practice (i.e., Unix features documented in SVID\n3):\n\n•   It assigns exit code 4 to “invalid operand”, which may be the same as unknown capability.\nFor instance, the source code for Solaris' xcurses uses the term “invalid” in this case.\n\n•   It  assigns  exit  code  255  to a numeric variable that is not specified in the terminfo\ndatabase.  That likely is a documentation error, confusing the -1 written to the standard\noutput for an absent or cancelled numeric value versus an (unsigned) exit code.\n\nThe various Unix systems (AIX, HPUX, Solaris) use the same exit-codes as ncurses.\n\nNetBSD  curses  documents  different  exit codes which do not correspond to either ncurses or\nX/Open.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "clear(1), stty(1), tabs(1), tset(1), termcap(3NCURSES), terminfo(5).\n\nThis describes ncurses version 6.3 (patch 20211021).\n\n\n\ntput(1)",
                "subsections": []
            }
        }
    }
}