1.\" $OpenBSD: termcap.5,v 1.32 2024/01/23 22:28:20 millert Exp $ 2.\" 3.\" Copyright (c) 1985, 1991 The Regents of the University of California. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" from: @(#)termcap.5 6.11 (Berkeley) 3/6/93 31.\" 32.Dd $Mdocdate: January 23 2024 $ 33.Dt TERMCAP 5 34.Os 35.Sh NAME 36.Nm termcap 37.Nd terminal capability database 38.Sh DESCRIPTION 39The 40.Nm 41file 42is a database describing terminals, used, for example, by 43.Xr vi 1 44and 45.Xr curses 3 . 46Terminals are described in 47.Nm 48by giving a set of capabilities that they have and by describing 49how operations are performed. 50Padding requirements and initialization sequences 51are included in 52.Nm . 53.Pp 54Entries in 55.Nm 56consist of a number of `:'-separated fields. 57The first entry for each terminal gives the names that are known for the 58terminal, separated by `|' characters. 59The first name given is the most common abbreviation for the terminal. 60The last name given should be a long name fully identifying the terminal, 61and all others are understood as synonyms for the terminal name. 62All names but the last should be in lower case and contain no blanks; 63the last name may well contain upper case characters and blanks for 64readability. 65.Pp 66Terminal names (except for the last, verbose entry) 67should be chosen using the following conventions. 68The particular piece of hardware making up the terminal 69should have a root name chosen, thus 70.Dq hp2621 71This name should not contain hyphens. 72Modes that the hardware can be in 73or user preferences 74should be indicated by appending a hyphen and an indicator of the mode. 75Therefore, a 76.Dq vt100 77in 132-column mode would be 78.Dq vt100-w . 79.Pp 80The following suffixes should be used where possible: 81.Bl -column "Suffix" "With automatic margins (usually default)" "Example" 82.It Sy Suffix Ta Sy Meaning Ta Sy Example 83.It \-w Ta "Wide mode (more than 80 columns)." Ta vt100-w 84.It \-am Ta "With automatic margins (usually default)." Ta vt100-am 85.It \-nam Ta "Without automatic margins." Ta vt100-nam 86.It Pf \- Ar n Ta "Number of lines on screen." Ta aaa-60 87.It \-na Ta "arrow keys (leave them in local)." Ta concept100-na 88.It Pf \- Ar np Ta "Number of pages of memory." Ta concept100-4p 89.It \-rv Ta "Reverse video." Ta concept100-rv 90.El 91.Sh CAPABILITIES 92The characters in the 93.Em Notes 94function 95field in the table have the following meanings 96(more than one may apply to a capability): 97.Bd -unfilled 98N Indicates numeric parameter(s). 99P Indicates that padding may be specified. 100* Indicates that padding may be based on the number of lines affected. 101o Indicates capability is obsolete. 102.Ed 103.Pp 104.Dq Obsolete 105capabilities have no 106.Xr terminfo 5 107equivalents, since they were considered useless, 108or are subsumed by other capabilities. 109New software should not rely on them at all. 110.Bl -column "i1-i3" "Type" "(NP*)" "Description" 111.It Sy Name Ta Sy Type Ta Sy Notes Ta Sy Description 112.It ae Ta str Ta (P) Ta "End alternate character set." 113.It AL Ta str Ta (NP*) Ta "Add" 114.Em n 115new blank lines 116.It al Ta str Ta (P*) Ta "Add new blank line." 117.It am Ta bool Ta "" Ta "Terminal has automatic margins." 118.It as Ta str Ta (P) Ta "Start alternate character set." 119.It bc Ta str Ta (o) Ta "Backspace if not" 120.Sy \&^H . 121.It bl Ta str Ta (P) Ta "Audible signal (bell)." 122.It bs Ta bool Ta (o) Ta "Terminal can backspace with" 123.Sy \&^H . 124.It bt Ta str Ta (P) Ta "Back tab." 125.It bw Ta bool Ta "" Ta Sy \&le 126(backspace) wraps from column 0 to last column. 127.It CC Ta str Ta "" Ta "Terminal settable command character in prototype." 128.It cd Ta str Ta (P*) Ta "Clear to end of display." 129.It ce Ta str Ta (P) Ta "Clear to end of line." 130.It ch Ta str Ta (NP) Ta "Set cursor column (horizontal position)." 131.It cl Ta str Ta (P*) Ta "Clear screen and home cursor." 132.It CM Ta str Ta (NP) Ta "Memory-relative cursor addressing." 133.It cm Ta str Ta (NP) Ta "Screen-relative cursor motion." 134.It co Ta num Ta "" Ta "Number of columns in a line (see" 135.Sx BUGS 136section below). 137.It cr Ta str Ta (P) Ta "Carriage return." 138.It cs Ta str Ta (NP) Ta "Change scrolling region (VT100)." 139.It ct Ta str Ta (P) Ta "Clear all tab stops." 140.It cv Ta str Ta (NP) Ta "Set cursor row (vertical position)." 141.It da Ta bool Ta "" Ta "Display may be retained above the screen." 142.It dB Ta num Ta (o) Ta "Milliseconds" 143.Sy \&bs 144delay needed (default 0). 145.It db Ta bool Ta "" Ta "Display may be retained below the screen." 146.It DC Ta str Ta (NP*) Ta "Delete" 147.Em n 148characters. 149.It dC Ta num Ta (o) Ta "Milliseconds" 150.Sy \&cr 151delay needed (default 0). 152.It dc Ta str Ta (P*) Ta "Delete character." 153.It dF Ta num Ta (o) Ta "Milliseconds" 154.Sy \&ff 155delay needed (default 0). 156.It DL Ta str Ta (NP*) Ta "Delete" 157.Ar n 158lines. 159.It dl Ta str Ta (P*) Ta "Delete line." 160.It dm Ta str Ta "" Ta "Enter delete mode." 161.It dN Ta num Ta (o) Ta "Milliseconds" 162.Sy \&nl 163delay needed (default 0). 164.It DO Ta str Ta (NP*) Ta "Move cursor down" 165.Ar n 166lines. 167.It do Ta str Ta "" Ta "Down one line." 168.It ds Ta str Ta "" Ta "Disable status line." 169.It dT Ta num Ta (o) Ta "Milliseconds of horizontal tab delay needed (default 0)." 170.It dV Ta num Ta (o) Ta "Milliseconds of vertical tab delay needed (default 0)." 171.It ec Ta str Ta (NP) Ta "Erase" 172.Ar n 173characters. 174.It ed Ta str Ta "" Ta "End delete mode." 175.It ei Ta str Ta "" Ta "End insert mode." 176.It eo Ta bool Ta "" Ta "Can erase overstrikes with a blank." 177.It EP Ta bool Ta (o) Ta "Even parity." 178.It es Ta bool Ta "" Ta "Escape can be used on the status line." 179.It ff Ta str Ta (P*) Ta "Hardcopy terminal page eject." 180.It fs Ta str Ta "" Ta "Return from status line." 181.It gn Ta bool Ta "" Ta "Generic line type, for example dialup, switch)." 182.It hc Ta bool Ta "" Ta "Hardcopy terminal." 183.It HD Ta bool Ta (o) Ta "Half-duplex." 184.It hd Ta str Ta "" Ta "Half-line down (forward 1/2 linefeed)." 185.It ho Ta str Ta (P) Ta "Home cursor." 186.It hs Ta bool Ta "" Ta "Has extra" 187.Dq status line . 188.It hu Ta str Ta "" Ta "Half-line up (reverse 1/2 linefeed)." 189.It hz Ta bool Ta "" Ta "Cannot print ``~'' (Hazeltine)." 190.It i1-i3 Ta str Ta "" Ta "Terminal initialization strings" 191.Pq Xr terminfo 5 No only 192.It IC Ta str Ta (NP*) Ta "Insert" 193.Ar n 194blank characters. 195.It ic Ta str Ta (P*) Ta "Insert character." 196.It if Ta str Ta "" Ta "Name of file containing initialization string." 197.It im Ta str Ta "" Ta "Enter insert mode." 198.It in Ta bool Ta "" Ta "Insert mode distinguishes nulls." 199.It iP Ta str Ta "" Ta "Pathname of program for initialization" 200.Pq Xr terminfo 5 No only 201.It ip Ta str Ta (P*) Ta "Insert pad after character inserted." 202.It is Ta str Ta "" Ta "Terminal initialization string" 203.Pf ( Nm termcap 204only). 205.It it Ta num Ta "" Ta "Tabs initially every" 206.Ar n 207positions. 208.It K1 Ta str Ta "" Ta "Sent by keypad upper left." 209.It K2 Ta str Ta "" Ta "Sent by keypad center." 210.It K3 Ta str Ta "" Ta "Sent by keypad upper right." 211.It K4 Ta str Ta "" Ta "Sent by keypad lower left." 212.It K5 Ta str Ta "" Ta "Sent by keypad lower right." 213.It k0-k9 Ta str Ta "" Ta "Sent by function keys 0-9." 214.It kA Ta str Ta "" Ta "Sent by insert-line key." 215.It ka Ta str Ta "" Ta "Sent by clear-all-tabs key." 216.It kb Ta str Ta "" Ta "Sent by backspace key." 217.It kC Ta str Ta "" Ta "Sent by clear-screen or erase key." 218.It kD Ta str Ta "" Ta "Sent by delete-character key." 219.It kd Ta str Ta "" Ta "Sent by down-arrow key." 220.It kE Ta str Ta "" Ta "Sent by clear-to-end-of-line key." 221.It ke Ta str Ta "" Ta "Out of" 222.Dq keypad transmit 223mode. 224.It kF Ta str Ta "" Ta "Sent by scroll-forward/down key." 225.It kH Ta str Ta "" Ta "Sent by home-down key." 226.It kh Ta str Ta "" Ta "Sent by home key." 227.It kI Ta str Ta "" Ta "Sent by insert-character or enter-insert-mode key." 228.It kL Ta str Ta "" Ta "Sent by delete-line key." 229.It kl Ta str Ta "" Ta "Sent by left-arrow key." 230.It kM Ta str Ta "" Ta "Sent by insert key while in insert mode." 231.It km Ta bool Ta "" Ta "Has a" 232.Dq meta 233key (shift, sets parity bit). 234.It kN Ta str Ta "" Ta "Sent by next-page key." 235.It kn Ta num Ta (o) Ta "Number of function" 236.Pq Sy \&k\&0 Ns \- Ns Sy \&k\&9 237keys (default 0). 238.It ko Ta str Ta (o) Ta "Termcap entries for other non-function keys." 239.It kP Ta str Ta "" Ta "Sent by previous-page key." 240.It kR Ta str Ta "" Ta "Sent by scroll-backward/up key." 241.It kr Ta str Ta "" Ta "Sent by right-arrow key." 242.It kS Ta str Ta "" Ta "Sent by clear-to-end-of-screen key." 243.It ks Ta str Ta "" Ta "Put terminal in" 244.Dq keypad transmit 245mode. 246.It kT Ta str Ta "" Ta "Sent by set-tab key." 247.It kt Ta str Ta "" Ta "Sent by clear-tab key." 248.It ku Ta str Ta "" Ta "Sent by up-arrow key." 249.It l0-l9 Ta str Ta "" Ta "Labels on function keys if not" 250.Dq \&f Ns Em n . 251.It LC Ta bool Ta (o) Ta "Lower-case only." 252.It LE Ta str Ta (NP) Ta "Move cursor left" 253.Ar n 254positions. 255.It le Ta str Ta (P) Ta "Move cursor left one position." 256.It li Ta num Ta "" Ta "Number of lines on screen or page (see" 257.Sx BUGS 258section below). 259.It ll Ta str Ta "" Ta "Last line, first column." 260.It lm Ta num Ta "" Ta "Lines of memory if >" Sy \&li 261(0 means varies). 262.It ma Ta str Ta (o) Ta "Arrow key map (used by" 263.Xr vi 1 264version 2 only). 265.It mb Ta str Ta "" Ta "Turn on blinking attribute." 266.It md Ta str Ta "" Ta "Turn on bold (extra bright) attribute." 267.It me Ta str Ta "" Ta "Turn off all attributes." 268.It mh Ta str Ta "" Ta "Turn on half-bright attribute." 269.It mi Ta bool Ta "" Ta "Safe to move while in insert mode." 270.It mk Ta str Ta "" Ta "Turn on blank attribute (characters invisible)." 271.It ml Ta str Ta (o) Ta "Memory lock on above cursor." 272.It mm Ta str Ta "" Ta "Turn on" 273.Dq meta mode 274(8th bit). 275.It mo Ta str Ta "" Ta "Turn off" 276.Dq meta mode . 277.It mp Ta str Ta "" Ta "Turn on protected attribute." 278.It mr Ta str Ta "" Ta "Turn on reverse-video attribute." 279.It ms Ta bool Ta "" Ta "Safe to move in standout modes." 280.It mu Ta str Ta (o) Ta "Memory unlock (turn off memory lock)." 281.It nc Ta bool Ta (o) Ta "No correctly-working" 282.Sy \&cr 283(Datamedia 2500, Hazeltine 2000). 284.It nd Ta str Ta "" Ta "Non-destructive space (cursor right)." 285.It NL Ta bool Ta (o)" Ta Sy \&\en No "is newline, not line feed." 286.It nl Ta str Ta (o) Ta "Newline character if not" Sy \en . 287.It ns Ta bool Ta (o) Ta "Terminal doesn't scroll." 288.It nw Ta str Ta (P) Ta "Newline (behaves like" 289.Sy \&cr 290followed by 291.Sy \&do ) . 292.It OP Ta bool Ta (o) Ta "Odd parity." 293.It os Ta bool Ta "" Ta "Terminal overstrikes." 294.It pb Ta num Ta "" Ta "Lowest baud where delays are required." 295.It pc Ta str Ta "" Ta "Pad character (default NUL)." 296.It pf Ta str Ta "" Ta "Turn off the printer." 297.It pk Ta str Ta "" Ta "Program function key" 298.Em n 299to type string 300.Em s 301.Pq Xr terminfo 5 No only 302.It pl Ta str Ta "" Ta "Program function key" 303.Em n 304to execute string 305.Em s 306.Pq Xr terminfo 5 No only 307.It pO Ta str Ta (N) Ta "Turn on the printer for" 308.Em n 309bytes. 310.It po Ta str Ta "" Ta "Turn on the printer." 311.It ps Ta str Ta "" Ta "Print contents of the screen." 312.It pt Ta bool Ta (o) Ta "Has hardware tabs (may need to be set with" 313.Sy \&is ) . 314.It px Ta str Ta "" Ta "Program function key" 315.Em n 316to transmit string 317.Em s 318.Pq Xr terminfo 5 No only 319.It r1-r3 Ta str Ta "" Ta "Reset terminal completely to sane modes" 320.Pq Xr terminfo 5 No only 321.It rc Ta str Ta (P) Ta "Restore cursor to position of last" 322.Sy \&sc . 323.It rf Ta str Ta "" Ta "Name of file containing reset codes." 324.It RI Ta str Ta (NP) Ta "Move cursor right" 325.Em n 326positions. 327.It rp Ta str Ta (NP*) Ta "Repeat character" 328.Em c n 329times. 330.It rs Ta str Ta "" Ta "Reset terminal completely to sane modes" 331.Pf ( Nm termcap 332only). 333.It sa Ta str Ta (NP) Ta "Define the video attributes." 334.It sc Ta str Ta (P) Ta "Save cursor position." 335.It se Ta str Ta "" Ta "End standout mode." 336.It SF Ta str Ta (NP*) Ta "Scroll forward" 337.Em n 338lines. 339.It sf Ta str Ta (P) Ta "Scroll text up." 340.It sg Ta num Ta "" Ta "Number of garbage chars left by" 341.Sy \&so 342or 343.Sy \&se 344(default 0). 345.It so Ta str Ta "" Ta "Begin standout mode." 346.It SR Ta str Ta (NP*) Ta "Scroll backward" 347.Em n 348lines. 349.It sr Ta str Ta (P) Ta "Scroll text down." 350.It st Ta str Ta "" Ta "Set a tab in all rows, current column." 351.It ta Ta str Ta (P) Ta "Tab to next 8-position hardware tab stop." 352.It tc Ta str Ta "" Ta "Entry of similar terminal; must be last." 353.It te Ta str Ta "" Ta "String to end programs that use" 354.Nm . 355.It ti Ta str Ta "" Ta "String to begin programs that use" 356.Nm . 357.It ts Ta str Ta (N) Ta "Go to status line, column" 358.Em n . 359.It UC Ta bool Ta (o) Ta "Upper-case only." 360.It uc Ta str Ta "" Ta "Underscore one character and move past it." 361.It ue Ta str Ta "" Ta "End underscore mode." 362.It ug Ta num Ta "" Ta "Number of garbage chars left by" 363.Sy \&us 364or 365.Sy \&ue 366(default 0). 367.It ul Ta bool Ta "" Ta "Underline character overstrikes." 368.It UP Ta str Ta (NP*) Ta "Move cursor up" 369.Em n 370lines. 371.It up Ta str Ta "" Ta "Upline (cursor up)." 372.It us Ta str Ta "" Ta "Start underscore mode." 373.It vb Ta str Ta "" Ta "Visible bell (must not move cursor)." 374.It ve Ta str Ta "" Ta "Make cursor appear normal (undo" 375.Sy \&vs Ns / Ns Sy \&vi ) . 376.It vi Ta str Ta "" Ta "Make cursor invisible." 377.It vs Ta str Ta "" Ta "Make cursor very visible." 378.It vt Ta num Ta "" Ta "Virtual terminal number (not supported on all systems)." 379.It wi Ta str Ta (N) Ta "Set current window." 380.It ws Ta num Ta "" Ta "Number of columns in status line." 381.It xb Ta bool Ta "" Ta "Beehive" 382.Pf ( "f1=" Dv ESC , 383.Pf "f2=" Sy \&^C ) . 384.It xn Ta bool Ta "" Ta "Newline ignored after 80 columns (Concept)." 385.It xo Ta bool Ta "" Ta "Terminal uses xoff/xon" 386.Pq Dv DC3 Ns / Ns Dv DC1 387handshaking. 388.It xr Ta bool Ta (o) Ta "Return acts like" 389.Sy "ce cr nl" 390(Delta Data). 391.It xs Ta bool Ta "" Ta "Standout not erased by overwriting (Hewlett-Packard)." 392.It xt Ta bool Ta "" Ta "Tabs ruin, magic" 393.Sy \&so 394char (Teleray 1061). 395.It xx Ta bool Ta (o) Ta "Tektronix 4025 insert-line." 396.El 397.Ss A Sample Entry 398The following entry, which describes the Concept\-100, is among the more 399complex entries in the 400.Nm 401file as of this writing. 402.Bd -literal 403ca\||\|concept100\||\|c100\||\|concept\||\|c104\||\|concept100-4p\||\|HDS Concept\-100:\e 404 :al=3*\eE^R:am:bl=^G:cd=16*\eE^C:ce=16\eE^U:cl=2*^L:cm=\eEa%+ %+ :\e 405 :co#80:.cr=9^M:db:dc=16\eE^A:dl=3*\eE^B:do=^J:ei=\eE\e200:eo:im=\eE^P:in:\e 406 :ip=16*:is=\eEU\eEf\eE7\eE5\eE8\eEl\eENH\eEK\eE\e200\eEo&\e200\eEo\e47\eE:k1=\eE5:\e 407 :k2=\eE6:k3=\eE7:kb=^h:kd=\eE<:ke=\eEx:kh=\eE?:kl=\eE>:kr=\eE=:ks=\eEX:\e 408 :ku=\eE;:le=^H:li#24:mb=\eEC:me=\eEN\e200:mh=\eEE:mi:mk=\eEH:mp=\eEI:\e 409 :mr=\eED:nd=\eE=:pb#9600:rp=0.2*\eEr%.%+ :se=\eEd\eEe:sf=^J:so=\eEE\eED:\e 410 :.ta=8\et:te=\eEv \e200\e200\e200\e200\e200\e200\eEp\er\en:\e 411 :ti=\eEU\eEv 8p\eEp\er:ue=\eEg:ul:up=\eE;:us=\eEG:\e 412 :vb=\eEk\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\eEK:\e 413 :ve=\eEw:vs=\eEW:vt#8:xn:\e 414 :bs:cr=^M:dC#9:dT#8:nl=^J:ta=^I:pt: 415.Ed 416.Pp 417Entries may continue onto multiple lines by giving a 418.Ql \e 419as the last character of a line, and empty fields 420may be included for readability (here between the last field on a line 421and the first field on the next). 422Comments may be included on lines beginning with 423.Ql # . 424.Ss Types of Capabilities 425Capabilities in 426.Nm 427are of three types: Boolean capabilities, 428which indicate particular features that the terminal has; 429numeric capabilities, 430giving the size of the display or the size of other attributes; 431and string capabilities, 432which give character sequences that can be used to perform particular 433terminal operations. 434All capabilities have two-letter codes. 435For instance, the fact that 436the Concept has 437.Em automatic margins 438(an automatic return and linefeed 439when the end of a line is reached) is indicated by the Boolean capability 440.Sy \&am . 441Hence the description of the Concept includes 442.Sy \&am . 443.Pp 444Boolean capabilities are defined by their name, 445.Sy \&fo . 446They have no argument. 447The presence of a boolean capability name sets its value to 448.Sy \&true . 449A capability value will be reverted to 450.Sy \&false , 451by appending a 452.Sy \&@ 453char after the name, such as 454.Sy \&fo@ . 455.Pp 456Numeric capabilities are followed by the character `#' then the value. 457In the example above 458.Sy \&co , 459which indicates the number of columns the display has, 460gives the value `80' for the Concept. 461.Pp 462Finally, string-valued capabilities, such as 463.Sy \&ce 464(clear-to-end-of-line 465sequence) are given by the two-letter code, an `=', then a string 466ending at the next following `:'. 467A delay in milliseconds may appear after 468the `=' in such a capability, 469which causes padding characters to be supplied by 470.Xr tputs 3 471after the remainder of the string is sent to provide this delay. 472The delay can be either a number, 473such as `20', or a number followed by 474an `*', 475such as `3*'. 476An `*' indicates that the padding required is proportional 477to the number of lines affected by the operation, and the amount given is 478the per-affected-line padding required. 479(In the case of insert-character, 480the factor is still the number of 481.Em lines 482affected; 483this is always 1 unless the terminal has 484.Sy \&in 485and the software uses it.) 486When an `*' is specified, it is sometimes useful to give a delay of the form 487`3.5' to specify a delay per line to tenths of milliseconds. 488(Only one decimal place is allowed.) 489.Pp 490A number of escape sequences are provided in the string-valued capabilities 491for easy encoding of control characters there. 492.Sy \&\eE 493maps to an 494.Dv ESC 495character, 496.Sy \&^X 497maps to a control-X for any appropriate X, 498and the sequences 499.Sy \&\en 500.Sy \&\er 501.Sy \&\et 502.Sy \&\eb 503.Sy \&\ef 504map to linefeed, return, tab, backspace, and formfeed, respectively. 505Finally, characters may be given as three octal digits after a 506.Sy \&\e , 507and the characters 508.Sy \&^ 509and 510.Sy \&\e 511may be given as 512.Sy \&\e^ 513and 514.Sy \&\e\e . 515If it is necessary to place a 516.Sy \&: 517in a capability, it must be escaped in octal as 518.Sy \&\e072 . 519If it is necessary to place a 520.Dv NUL 521character in a string capability, it must be encoded as 522.Sy \&\e200 . 523(The routines that deal with 524.Nm 525use C strings and strip the high bits of the output very late, so that a 526.Sy \&\e200 527comes out as a 528.Sy \&\e000 529would.) 530.Pp 531Sometimes individual capabilities must be commented out. 532To do this, put a period before the capability name. 533For example, see the first 534.Sy \&cr 535and 536.Sy \&ta 537in the example above. 538.Ss Preparing Descriptions 539The most effective way to prepare a terminal description is by imitating 540the description of a similar terminal in 541.Nm 542and to build up a description gradually, using partial descriptions 543with 544.Xr vi 1 545to check that they are correct. 546Be aware that a very unusual terminal may expose deficiencies in 547the ability of the 548.Nm 549file to describe it 550or bugs in 551.Xr vi 1 . 552To easily test a new terminal description you are working on 553you can put it in your home directory in a file called 554.Pa .termcap 555and programs will look there before looking in 556.Pa /usr/share/misc/termcap . 557You can also set the environment variable 558.Ev TERMPATH 559to a list of absolute file pathnames (separated by spaces or colons), 560one of which contains the description you are working on, 561and programs will search them in the order listed, and nowhere else. 562See 563.Xr termcap 3 . 564The 565.Ev TERMCAP 566environment variable is usually set to the 567.Nm 568entry itself 569to avoid reading files when starting up a program. 570.Pp 571To get the padding for insert-line right 572(if the terminal manufacturer did not document it), 573a severe test is to use 574.Xr vi 1 575to edit 576.Pa /etc/passwd 577at 9600 baud, delete roughly 16 lines from the middle of the screen, 578then hit the `u' key several times quickly. 579If the display messes up, more padding is usually needed. 580A similar test can be used for insert-character. 581.Ss Basic Capabilities 582The number of columns on each line of the display is given by the 583.Sy \&co 584numeric capability. 585If the display is a terminal, 586then the 587number of lines on the screen is given by the 588.Sy \&li 589capability. 590If the display wraps around to the beginning of the next line when 591the cursor reaches the right margin, then it should have the 592.Sy \&am 593capability. 594If the terminal can clear its screen, 595the code to do this is given by the 596.Sy \&cl 597string capability. 598If the terminal overstrikes 599(rather than clearing the position when a character is overwritten), 600it should have the 601.Sy \&os 602capability. 603If the terminal is a printing terminal, 604with no soft copy unit, 605give it both 606.Sy \&hc 607and 608.Sy \&os . 609.Pf ( Sy \&os 610applies to storage scope terminals, 611such as the Tektronix 4010 series, 612as well as to hard copy and 613.Tn APL 614terminals.) 615If there is a code to move the cursor to the left edge of the current row, 616give this as 617.Sy \&cr . 618(Normally this will be carriage-return, 619.Sy \&^M . ) 620If there is a code to produce an audible signal (bell, beep, etc.), 621give this as 622.Sy \&bl . 623.Pp 624If there is a code (such as backspace) 625to move the cursor one position to the left, 626that capability should be given as 627.Sy \&le . 628Similarly, 629codes to move to the right, up, and down 630should be given as 631.Sy \&nd , 632.Sy \&up , 633and 634.Sy \&do , 635respectively. 636These 637.Em local cursor motions 638should not alter the text they pass over; 639for example, you would not normally use 640.Dq nd=\ \& 641unless the terminal has the 642.Sy \&os 643capability, 644because the space would erase the character moved over. 645.Pp 646A very important point here is that the local cursor motions encoded 647in 648.Nm 649have undefined behavior at the left and top edges of a terminal. 650Programs should never attempt to backspace around the left edge, 651unless 652.Sy \&bw 653is given, and never attempt to go up off the top 654using local cursor motions. 655.Pp 656In order to scroll text up, 657a program goes to the bottom left corner of the screen and sends the 658.Sy \&sf 659(index) string. 660To scroll text down, 661a program goes to the top left corner of the screen and sends the 662.Sy \&sr 663(reverse index) string. 664The strings 665.Sy \&sf 666and 667.Sy \&sr 668have undefined behavior 669when not on their respective corners of the screen. 670Parameterized versions of the scrolling sequences are 671.Sy \&SF 672and 673.Sy \&SR , 674which have the same semantics as 675.Sy \&sf 676and 677.Sy \&sr 678except that they take one parameter 679and scroll that many lines. 680They also have undefined behavior 681except at the appropriate corner of the screen. 682.Pp 683The 684.Sy \&am 685capability tells whether the cursor sticks at the right 686edge of the screen when text is output there, 687but this does not necessarily apply to 688.Sy \&nd 689from the last column. 690Leftward local motion is defined from the left edge only when 691.Sy \&bw 692is given; then an 693.Sy \&le 694from the left edge will move to the right edge of the previous row. 695This is useful for drawing a box around the edge of the screen, 696for example. 697If the terminal has switch-selectable automatic margins, 698the 699.Nm 700description usually assumes that this feature is on, i.e.\& 701.Sy \&am . 702If the terminal has a command 703that moves to the first column of the next line, 704that command can be given as 705.Sy \&nw 706(newline). 707It is permissible for this to clear the remainder of the current line, 708so if the terminal has no correctly working 709.Tn \&CR 710and 711.Tn \&LF 712it may still be possible to craft a working 713.Sy \&nw 714out of one or both of them. 715.Pp 716These capabilities suffice to describe hardcopy and 717.Dq glass-tty 718terminals. 719Thus the Teletype model 33 is described as 720.Bd -literal -offset indent 721T3\||\|tty33\||\|33\||\|tty\||\|Teletype model 33:\e 722 :bl=^G:co#72:cr=^M:do=^J:hc:os: 723.Ed 724.Pp 725and the Lear Siegler 726.Tn ADM Ns \-3 727is described as 728.Bd -literal -offset indent 729l3\||\|adm3\||\|3\||\|LSI ADM-3:\e 730:am:bl=^G:cl=^Z:co#80:cr=^M:do=^J:le=^H:li#24:sf=^J: 731.Ed 732.Ss Parameterized Strings 733Cursor addressing and other strings requiring parameters 734are described by a 735parameterized string capability, with 736.Xr printf 3 Ns \-like 737escapes 738.Sy \&%x 739in it, 740while other characters are passed through unchanged. 741For example, to address the cursor the 742.Sy \&cm 743capability is given, using two parameters: the row and column to move to. 744(Rows and columns are numbered from zero and refer to the physical screen 745visible to the user, not to any unseen memory. 746If the terminal has memory-relative cursor addressing, 747that can be indicated by an analogous 748.Sy \&CM 749capability.) 750.Pp 751The 752.Sy \&% 753encodings have the following meanings: 754.Pp 755.Bl -tag -width "%>xy" -compact 756.It %% 757output `%' 758.It %d 759output value as in 760.Xr printf 3 761%d 762.It %2 763output value as in 764.Xr printf 3 765%2d 766.It %3 767output value as in 768.Xr printf 3 769%3d 770.It %. 771output value as in 772.Xr printf 3 773%c 774.It %+ Ns Em x 775add 776.Em x 777to value, then do %. 778.It %> Ns Em \&xy 779if 780value > 781.Em x 782then add 783.Em y , 784no output 785.It %r 786reverse order of two parameters, no output 787.It %i 788increment by one, no output 789.It %n 790exclusive-or all parameters with 0140 (Datamedia 2500) 791.It \&%B 792BCD (16*(value/10)) + (value%10), no output 793.It \&%D 794Reverse coding (value \- 2*(value%16)), no output (Delta Data) 795.El 796.Pp 797Consider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needs 798to be sent 799.Dq \eE&a12c03Y 800padded for 6 milliseconds. 801Note that the order 802of the row and column coordinates is reversed here 803and that the row and column 804are sent as two-digit integers. 805Thus its 806.Sy \&cm 807capability is 808.Dq Li cm=6\eE&a%r%2c%2Y . 809.Pp 810The Datamedia 2500 needs the current row and column sent 811encoded in binary using 812.Dq \&%. . 813Terminals that use 814.Dq \&%. 815need to be able to 816backspace the cursor 817.Pq Sy \&le 818and to move the cursor up one line on the screen 819.Pq Sy \&up . 820This is necessary because it is not always safe to transmit 821.Sy \&\en , 822.Sy \&^D , 823and 824.Sy \&\er , 825as the system may change or discard them. 826(Programs using 827.Nm 828must set terminal modes so that tabs are not expanded, so 829.Sy \&\et 830is safe to send. 831This turns out to be essential for the Ann Arbor 4080.) 832.Pp 833A final example is the Lear Siegler 834.Tn ADM Ns \-3a , 835which offsets row and column 836by a blank character, thus 837.Dq Li cm=\eE=%+ %+\ \& . 838.Pp 839Row or column absolute cursor addressing 840can be given as single parameter capabilities 841.Sy \&ch 842(horizontal position absolute) and 843.Sy \&cv 844(vertical position absolute). 845Sometimes these are shorter than the more general two-parameter sequence 846(as with the Hewlett-Packard 2645) and can be used in preference to 847.Sy \&cm . 848If there are parameterized local motions 849(e.g., move 850.Ar n 851positions to the right) 852these can be given as 853.Sy \&DO , 854.Sy \&LE , 855.Sy \&RI , 856and 857.Sy \&UP 858with a single parameter indicating how many positions to move. 859These are primarily useful if the terminal does not have 860.Sy \&cm , 861such as the Tektronix 4025. 862.Ss Cursor Motions 863If the terminal has a fast way to home the cursor 864(to the very upper left corner of the screen), this can be given as 865.Sy \&ho . 866Similarly, a fast way of getting to the lower left-hand corner 867can be given as 868.Sy \&ll ; 869this may involve going up with 870.Sy \&up 871from the home position, 872but a program should never do this itself (unless 873.Sy \&ll 874does), because it can 875make no assumption about the effect of moving up from the home position. 876Note that the home position is the same as 877cursor address (0,0): to the top left corner of the screen, not of memory. 878(Therefore, the 879.Dq \eEH 880sequence on Hewlett-Packard terminals 881cannot be used for 882.Sy \&ho . ) 883.Ss Area Clears 884If the terminal can clear from the current position to the end of the 885line, leaving the cursor where it is, this should be given as 886.Sy \&ce . 887If the terminal can clear from the current position to the end of the 888display, this should be given as 889.Sy \&cd . 890.Sy \&cd 891must only be invoked from the first column of a line. 892(Therefore, 893it can be simulated by a request to delete a large number of lines, 894if a true 895.Sy \&cd 896is not available.) 897.Ss Insert/Delete Line 898If the terminal can open a new blank line 899before the line containing the cursor, 900this should be given as 901.Sy \&al ; 902this must be invoked only from the first 903position of a line. 904The cursor must then appear at the left of the newly blank line. 905If the terminal can delete the line that the cursor is on, this 906should be given as 907.Sy \&dl ; 908this must only be used from the first position on 909the line to be deleted. 910Versions of 911.Sy \&al 912and 913.Sy \&dl 914which take a single parameter 915and insert or delete that many lines 916can be given as 917.Sy \&AL 918and 919.Sy \&DL . 920If the terminal has a settable scrolling region 921(like the VT100), 922the command to set this can be described with the 923.Sy \&cs 924capability, 925which takes two parameters: the top and bottom lines of the scrolling region. 926The cursor position is, alas, undefined after using this command. 927It is possible to get the effect of insert or delete line 928using this command \(em the 929.Sy \&sc 930and 931.Sy \&rc 932(save and restore cursor) commands are also useful. 933Inserting lines at the top or bottom of the screen can also be done using 934.Sy \&sr 935or 936.Sy \&sf 937on many terminals without a true insert/delete line, 938and is often faster even on terminals with those features. 939.Pp 940If the terminal has the ability to define a window as part of memory 941which all commands affect, it should be given as the parameterized string 942.Sy \&wi . 943The four parameters are the starting and ending lines in memory 944and the starting and ending columns in memory, in that order. 945(This 946.Xr terminfo 5 947capability is described for completeness. 948It is unlikely that any 949.Nm Ns -using 950program will support it.) 951.Pp 952If the terminal can retain display memory above the screen, then the 953.Sy \&da 954capability should be given; 955if display memory can be retained 956below, then 957.Sy \&db 958should be given. 959These indicate 960that deleting a line or scrolling may bring non-blank lines up from below 961or that scrolling back with 962.Sy \&sr 963may bring down non-blank lines. 964.Ss Insert/Delete Character 965There are two basic kinds of intelligent terminals with respect to 966insert/delete character that can be described using 967.Nm . 968The most common insert/delete character operations affect only the characters 969on the current line and shift characters off the end of the line rigidly. 970Other terminals, such as the Concept\-100 and the Perkin Elmer Owl, make 971a distinction between typed and untyped blanks on the screen, shifting 972upon an insert or delete only to an untyped blank on the screen which is 973either eliminated or expanded to two untyped blanks. 974You can determine 975the kind of terminal you have by clearing the screen then typing 976text separated by cursor motions. 977Type 978.Dq Li abc\ \ \ \ def 979using local 980cursor motions (not spaces) between the 981.Dq abc 982and the 983.Dq def . 984Then position the cursor before the 985.Dq abc 986and put the terminal in insert 987mode. 988If typing characters causes the rest of the line to shift 989rigidly and characters to fall off the end, then your terminal does 990not distinguish between blanks and untyped positions. 991If the 992.Dq abc 993shifts over to the 994.Dq def 995which then move together around the end of the 996current line and onto the next as you insert, then you have the second type of 997terminal and should give the capability 998.Sy \&in , 999which stands for 1000.Dq insert null . 1001While these are two logically separate attributes 1002(one line 1003.Em \&vs . 1004multi-line insert mode, 1005and special treatment of untyped spaces), 1006we have seen no terminals whose insert 1007mode cannot be described with the single attribute. 1008.Pp 1009.Nm 1010can describe both terminals that have an insert mode and terminals 1011that send a simple sequence to open a blank position on the current line. 1012Give as 1013.Sy \&im 1014the sequence to get into insert mode. 1015Give as 1016.Sy \&ei 1017the sequence to leave insert mode. 1018Now give as 1019.Sy \&ic 1020any sequence that needs to be sent just before 1021each character to be inserted. 1022Most terminals with a true insert mode 1023will not give 1024.Sy \&ic ; 1025terminals that use a sequence to open a screen 1026position should give it here. 1027(If your terminal has both, 1028insert mode is usually preferable to 1029.Sy \&ic . 1030Do not give both unless the terminal actually requires both to be used 1031in combination.) 1032If post-insert padding is needed, give this as a number of milliseconds 1033in 1034.Sy \&ip 1035(a string option). 1036Any other sequence that may need to be 1037sent after insertion of a single character can also be given in 1038.Sy \&ip . 1039If your terminal needs to be placed into an `insert mode' 1040and needs a special code preceding each inserted character, 1041then both 1042.Sy \&im Ns / Sy \&ei 1043and 1044.Sy \&ic 1045can be given, and both will be used. 1046The 1047.Sy \&IC 1048capability, with one parameter 1049.Em n , 1050will repeat the effects of 1051.Sy \&ic 1052.Em n 1053times. 1054.Pp 1055It is occasionally necessary to move around while in insert mode 1056to delete characters on the same line 1057(e.g., if there is a tab after the insertion position). 1058If your terminal allows motion while in 1059insert mode, you can give the capability 1060.Sy \&mi 1061to speed up inserting 1062in this case. 1063Omitting 1064.Sy \&mi 1065will affect only speed. 1066Some terminals 1067(notably Datamedia's) must not have 1068.Sy \&mi 1069because of the way their 1070insert mode works. 1071.Pp 1072Finally, you can specify 1073.Sy \&dc 1074to delete a single character, 1075.Sy \&DC 1076with one parameter 1077.Em n 1078to delete 1079.Em n 1080characters, 1081and delete mode by giving 1082.Sy \&dm 1083and 1084.Sy \&ed 1085to enter and exit delete mode 1086(which is any mode the terminal needs to be placed in for 1087.Sy \&dc 1088to work). 1089.Ss Highlighting, Underlining, and Visible Bells 1090If your terminal has one or more kinds of display attributes, 1091these can be represented in a number of different ways. 1092You should choose one display form as 1093.Em standout mode , 1094representing a good high-contrast, easy-on-the-eyes format 1095for highlighting error messages and other attention getters. 1096(If you have a choice, reverse video plus half-bright is good, 1097or reverse video alone.) 1098The sequences to enter and exit standout mode 1099are given as 1100.Sy \&so 1101and 1102.Sy \&se , 1103respectively. 1104If the code to change into or out of standout 1105mode leaves one or even two blank spaces or garbage characters on the screen, 1106as the 1107.Tn TVI 1108912 and Teleray 1061 do, 1109then 1110.Sy \&sg 1111should be given to tell how many characters are left. 1112.Pp 1113Codes to begin underlining and end underlining can be given as 1114.Sy \&us 1115and 1116.Sy \&ue , 1117respectively. 1118Underline mode change garbage is specified by 1119.Sy \&ug , 1120similar to 1121.Sy \&sg . 1122If the terminal has a code to underline the current character and move 1123the cursor one position to the right, 1124such as the Microterm Mime, 1125this can be given as 1126.Sy \&uc . 1127.Pp 1128Other capabilities to enter various highlighting modes include 1129.Sy \&mb 1130(blinking), 1131.Sy \&md 1132(bold or extra bright), 1133.Sy \&mh 1134(dim or half-bright), 1135.Sy \&mk 1136(blanking or invisible text), 1137.Sy \&mp 1138(protected), 1139.Sy \&mr 1140(reverse video), 1141.Sy \&me 1142(turn off 1143.Em all 1144attribute modes), 1145.Sy \&as 1146(enter alternate character set mode), and 1147.Sy \&ae 1148(exit alternate character set mode). 1149Turning on any of these modes singly may or may not turn off other modes. 1150.Pp 1151If there is a sequence to set arbitrary combinations of mode, 1152this should be given as 1153.Sy \&sa 1154(set attributes), taking 9 parameters. 1155Each parameter is either 0 or 1, 1156as the corresponding attributes is on or off. 1157The 9 parameters are, in order: standout, underline, reverse, blink, 1158dim, bold, blank, protect, and alternate character set. 1159Not all modes need be supported by 1160.Sy \&sa , 1161only those for which corresponding attribute commands exist. 1162(It is unlikely that a 1163.Nm Ns -using 1164program will support this capability, which is defined for compatibility 1165with 1166.Xr terminfo 5 . ) 1167.Pp 1168Terminals with the 1169.Dq magic cookie 1170glitches 1171.Pf ( Sy \&sg 1172and 1173.Sy \&ug ) , 1174rather than maintaining extra attribute bits for each character cell, 1175instead deposit special 1176.Dq cookies , 1177or 1178.Dq garbage characters , 1179when they receive mode-setting sequences, 1180which affect the display algorithm. 1181.Pp 1182Some terminals, 1183such as the Hewlett-Packard 2621, 1184automatically leave standout 1185mode when they move to a new line or when the cursor is addressed. 1186Programs using standout mode 1187should exit standout mode on such terminals 1188before moving the cursor or sending a newline. 1189On terminals where this is not a problem, 1190the 1191.Sy \&ms 1192capability should be present 1193to say that this overhead is unnecessary. 1194.Pp 1195If the terminal has 1196a way of flashing the screen to indicate an error quietly 1197(a bell replacement), 1198this can be given as 1199.Sy \&vb ; 1200it must not move the cursor. 1201.Pp 1202If the cursor needs to be made more visible than normal 1203when it is not on the bottom line 1204(to change, for example, a non-blinking underline into an easier-to-find 1205block or blinking underline), 1206give this sequence as 1207.Sy \&vs . 1208If there is a way to make the cursor completely invisible, give that as 1209.Sy \&vi . 1210The capability 1211.Sy \&ve , 1212which undoes the effects of both of these modes, 1213should also be given. 1214.Pp 1215If your terminal correctly displays underlined characters 1216(with no special codes needed) 1217even though it does not overstrike, 1218then you should give the capability 1219.Sy \&ul . 1220If overstrikes are erasable with a blank, 1221this should be indicated by giving 1222.Sy \&eo . 1223.Ss Keypad 1224If the terminal has a keypad that transmits codes when the keys are pressed, 1225this information can be given. 1226Note that it is not possible to handle 1227terminals where the keypad only works in local mode 1228(this applies, for example, to the unshifted Hewlett-Packard 2621 keys). 1229If the keypad can be set to transmit or not transmit, 1230give these codes as 1231.Sy \&ks 1232and 1233.Sy \&ke . 1234Otherwise the keypad is assumed to always transmit. 1235The codes sent by the left-arrow, right-arrow, up-arrow, down-arrow, 1236and home keys can be given as 1237.Sy \&kl , 1238.Sy \&kr , 1239.Sy \&ku , 1240.Sy \&kd , 1241and 1242.Sy \&kh , 1243respectively. 1244If there are function keys such as f0, f1, ..., f9, the codes they send 1245can be given as 1246.Sy \&k0 , 1247.Sy \&k1 , 1248\&..., 1249.Sy \&k9 . 1250If these keys have labels other than the default f0 through f9, the labels 1251can be given as 1252.Sy \&l0 , 1253.Sy \&l1 , 1254\&..., 1255.Sy \&l9 . 1256The codes transmitted by certain other special keys can be given: 1257.Sy \&kH 1258(home down), 1259.Sy \&kb 1260(backspace), 1261.Sy \&ka 1262(clear all tabs), 1263.Sy \&kt 1264(clear the tab stop in this column), 1265.Sy \&kC 1266(clear screen or erase), 1267.Sy \&kD 1268(delete character), 1269.Sy \&kL 1270(delete line), 1271.Sy \&kM 1272(exit insert mode), 1273.Sy \&kE 1274(clear to end of line), 1275.Sy \&kS 1276(clear to end of screen), 1277.Sy \&kI 1278(insert character or enter insert mode), 1279.Sy \&kA 1280(insert line), 1281.Sy \&kN 1282(next page), 1283.Sy \&kP 1284(previous page), 1285.Sy \&kF 1286(scroll forward/down), 1287.Sy \&kR 1288(scroll backward/up), and 1289.Sy \&kT 1290(set a tab stop in this column). 1291In addition, if the keypad has a 3 by 3 array of keys 1292including the four arrow keys, then the other five keys can be given as 1293.Sy \&K1 , 1294.Sy \&K2 , 1295.Sy \&K3 , 1296.Sy \&K4 , 1297and 1298.Sy \&K5 . 1299These keys are useful when the effects of a 3 by 3 directional pad are needed. 1300The obsolete 1301.Sy \&ko 1302capability formerly used to describe 1303.Dq other 1304function keys has been 1305completely supplanted by the above capabilities. 1306.Pp 1307The 1308.Sy \&ma 1309entry is also used to indicate arrow keys on terminals that have 1310single-character arrow keys. 1311It is obsolete but still in use in 1312version 2 of 1313.Sy \&vi 1314which must be run on some minicomputers due to 1315memory limitations. 1316This field is redundant with 1317.Sy \&kl , 1318.Sy \&kr , 1319.Sy \&ku , 1320.Sy \&kd , 1321and 1322.Sy \&kh . 1323It consists of groups of two characters. 1324In each group, the first character is what an arrow key sends, and the 1325second character is the corresponding 1326.Sy \&vi 1327command. 1328These commands are 1329.Ar h 1330for 1331.Sy \&kl , 1332.Ar j 1333for 1334.Sy \&kd , 1335.Ar k 1336for 1337.Sy \&ku , 1338.Ar l 1339for 1340.Sy \&kr , 1341and 1342.Ar H 1343for 1344.Sy \&kh . 1345For example, the Mime would have 1346.Dq Li ma=^Hh^Kj^Zk^Xl 1347indicating arrow keys left (^H), down (^K), up (^Z), and right (^X). 1348(There is no home key on the Mime.) 1349.Ss Tabs and Initialization 1350If the terminal needs to be in a special mode when running 1351a program that uses these capabilities, 1352the codes to enter and exit this mode can be given as 1353.Sy \&ti 1354and 1355.Sy \&te . 1356This arises, for example, from terminals like the Concept with more than 1357one page of memory. 1358If the terminal has only memory-relative cursor addressing and not 1359screen-relative cursor addressing, 1360a screen-sized window must be fixed into 1361the display for cursor addressing to work properly. 1362This is also used for the Tektronix 4025, where 1363.Sy \&ti 1364sets the command character to be the one used by 1365.Nm . 1366.Pp 1367Other capabilities 1368include 1369.Sy \&is , 1370an initialization string for the terminal, 1371and 1372.Sy \&if , 1373the name of a file containing long initialization strings. 1374These strings are expected to set the terminal into modes 1375consistent with the rest of the 1376.Nm 1377description. 1378They are normally sent to the terminal by the 1379.Xr tset 1 1380program each time the user logs in. 1381They will be printed in the following order: 1382.Sy \&is ; 1383setting tabs using 1384.Sy \&ct 1385and 1386.Sy \&st ; 1387and finally 1388.Sy \&if . 1389.Pf ( Xr terminfo 5 1390uses 1391.Sy \&i\&1-i2 1392instead of 1393.Sy \&is 1394and runs the program 1395.Sy \&iP 1396and prints 1397.Sy "\&i\&3" 1398after the other initializations.) 1399A pair of sequences that does a harder reset from a totally unknown state 1400can be analogously given as 1401.Sy \&rs 1402and 1403.Sy \&if . 1404These strings are output by the 1405.Xr reset 1 1406program, which is used when the terminal gets into a wedged state. 1407.Pf ( Xr terminfo 5 1408uses 1409.Sy "\&r1-r3" 1410instead of 1411.Sy \&rs . ) 1412Commands are normally placed in 1413.Sy \&rs 1414and 1415.Sy \&rf 1416only if they produce annoying effects on the screen and are not necessary 1417when logging in. 1418For example, the command to set the VT100 into 80-column mode 1419would normally be part of 1420.Sy \&is , 1421but it causes an annoying glitch of the screen and is not normally needed 1422since the terminal is usually already in 80-column mode. 1423.Pp 1424If the terminal has hardware tabs, 1425the command to advance to the next tab stop can be given as 1426.Sy \&ta 1427(usually 1428.Sy \&^I ) . 1429A 1430.Dq backtab 1431command which moves leftward to the previous tab stop 1432can be given as 1433.Sy \&bt . 1434By convention, 1435if the terminal driver modes indicate that tab stops are being expanded 1436by the computer rather than being sent to the terminal, 1437programs should not use 1438.Sy \&ta 1439or 1440.Sy \&bt 1441even if they are present, 1442since the user may not have the tab stops properly set. 1443If the terminal has hardware tabs that are initially set every 1444.Ar n 1445positions when the terminal is powered up, then the numeric parameter 1446.Sy \&it 1447is given, showing the number of positions between tab stops. 1448This is normally used by the 1449.Xr tset 1 1450command to determine whether to set the driver mode for hardware tab 1451expansion, and whether to set the tab stops. 1452If the terminal has tab stops that can be saved in nonvolatile memory, the 1453.Nm 1454description can assume that they are properly set. 1455.Pp 1456If there are commands to set and clear tab stops, they can be given as 1457.Sy \&ct 1458(clear all tab stops) and 1459.Sy \&st 1460(set a tab stop in the current column of every row). 1461If a more complex sequence is needed to set the tabs than can be 1462described by this, the sequence can be placed in 1463.Sy \&is 1464or 1465.Sy \&if . 1466.Ss Delays 1467Certain capabilities control padding in the terminal driver. 1468These are primarily needed by hardcopy terminals and are used by the 1469.Xr tset 1 1470program to set terminal driver modes appropriately. 1471Delays embedded in the capabilities 1472.Sy \&cr , 1473.Sy \&sf , 1474.Sy \&le , 1475.Sy \&ff , 1476and 1477.Sy \&ta 1478will cause the appropriate delay bits to be set in the terminal driver. 1479If 1480.Sy \&pb 1481(padding baud rate) is given, these values can be ignored at baud rates 1482below the value of 1483.Sy \&pb . 1484For 1485.Bx 4.2 1486.Xr tset 1 , 1487the delays are given as numeric capabilities 1488.Sy \&dC , 1489.Sy \&dN , 1490.Sy \&dB , 1491.Sy \&dF , 1492and 1493.Sy \&dT 1494instead. 1495.Ss Miscellaneous 1496If the terminal requires other than a 1497.Dv NUL 1498(zero) character as a pad, 1499this can be given as 1500.Sy \&pc . 1501Only the first character of the 1502.Sy \&pc 1503string is used. 1504.Pp 1505If the terminal has commands to save and restore the position of the 1506cursor, give them as 1507.Sy \&sc 1508and 1509.Sy \&rc . 1510.Pp 1511If the terminal has an extra 1512.Dq status line 1513that is not normally used by 1514software, this fact can be indicated. 1515If the status line is viewed as an extra line below the bottom line, 1516then the capability 1517.Sy \&hs 1518should be given. 1519Special strings to go to a position in the status line and to return 1520from the status line can be given as 1521.Sy \&ts 1522and 1523.Sy \&fs . 1524.Pf ( Sy \&fs 1525must leave the cursor position in the same place that it was before 1526.Sy \&ts . 1527If necessary, the 1528.Sy \&sc 1529and 1530.Sy \&rc 1531strings can be included in 1532.Sy \&ts 1533and 1534.Sy \&fs 1535to get this effect.) 1536The capability 1537.Sy \&ts 1538takes one parameter, which is the column number of the status line 1539to which the cursor is to be moved. 1540If escape sequences and other special commands such as tab work while in 1541the status line, the flag 1542.Sy \&es 1543can be given. 1544A string that turns off the status line (or otherwise erases its contents) 1545should be given as 1546.Sy \&ds . 1547The status line is normally assumed to be the same width as the 1548rest of the screen, i.e.\& 1549.Sy \&co . 1550If the status line is a different width (possibly because the terminal 1551does not allow an entire line to be loaded), then its width in columns 1552can be indicated with the numeric parameter 1553.Sy \&ws . 1554.Pp 1555If the terminal can move up or down half a line, this can be 1556indicated with 1557.Sy \&hu 1558(half-line up) and 1559.Sy \&hd 1560(half-line down). 1561This is primarily useful for superscripts and subscripts on hardcopy 1562terminals. 1563If a hardcopy terminal can eject to the next page (form feed), 1564give this as 1565.Sy \&ff 1566(usually 1567.Sy \&^L ) . 1568.Pp 1569If there is a command to repeat a given character a given number of times 1570(to save time transmitting a large number of identical characters), 1571this can be indicated with the parameterized string 1572.Sy \&rp . 1573The first parameter is the character to be repeated and the second is 1574the number of times to repeat it. 1575(This is a 1576.Xr terminfo 5 1577feature that is unlikely to be supported by a program that uses 1578.Nm . ) 1579.Pp 1580If the terminal has a settable command character, such as the 1581Tektronix 4025, this can be indicated with 1582.Sy \&CC . 1583A prototype command character is chosen which is used in all capabilities. 1584This character is given in the 1585.Sy \&CC 1586capability to identify it. 1587The following convention is supported on some 1588.Ux 1589systems: 1590The environment is to be searched for a 1591.Ev \&CC 1592variable, 1593and if found, 1594all occurrences of the prototype character are replaced by the character 1595in the environment variable. 1596This use of the 1597.Ev \&CC 1598environment variable 1599is a very bad idea, as it conflicts with 1600.Xr make 1 . 1601.Pp 1602Terminal descriptions that do not represent a specific kind of known 1603terminal, such as 1604.Em switch , 1605.Em dialup , 1606.Em patch , 1607and 1608.Em network , 1609should include the 1610.Sy \&gn 1611(generic) capability so that programs can complain that they do not know 1612how to talk to the terminal. 1613(This capability does not apply to 1614.Em virtual 1615terminal descriptions for which the escape sequences are known.) 1616.Pp 1617If the terminal uses xoff/xon 1618.Pq Tn DC3 Ns / Ns Tn DC1 1619handshaking for flow control, give 1620.Sy \&xo . 1621Padding information should still be included so that routines can make 1622better decisions about costs, but actual pad characters will not be 1623transmitted. 1624.Pp 1625If the terminal has a 1626.Dq meta key 1627which acts as a shift key, setting the 16288th bit of any character transmitted, then this fact can be indicated with 1629.Sy \&km . 1630Otherwise, software will assume that the 8th bit is parity and it will 1631usually be cleared. 1632If strings exist to turn this 1633.Dq meta mode 1634on and off, they can be given as 1635.Sy \&mm 1636and 1637.Sy \&mo . 1638.Pp 1639If the terminal has more lines of memory than will fit on the screen at once, 1640the number of lines of memory can be indicated with 1641.Sy \&lm . 1642An explicit value of 0 indicates that the number of lines is not fixed, 1643but that there is still more memory than fits on the screen. 1644.Pp 1645If the terminal is one of those supported by the 1646.Ux 1647system virtual 1648terminal protocol, the terminal number can be given as 1649.Sy \&vt . 1650.Pp 1651Media copy strings which control an auxiliary printer 1652connected to the terminal can be given as 1653.Sy \&ps : 1654print the contents of the screen; 1655.Sy \&pf : 1656turn off the printer; and 1657.Sy \&po : 1658turn on the printer. 1659When the printer is on, all text sent to the terminal will be sent to the 1660printer. 1661It is undefined whether the text is also displayed on the terminal screen 1662when the printer is on. 1663A variation 1664.Sy \&pO 1665takes one parameter and leaves the printer on for as many characters as the 1666value of the parameter, then turns the printer off. 1667The parameter should not exceed 255. 1668All text, including 1669.Sy \&pf , 1670is transparently passed to the printer while 1671.Sy \&pO 1672is in effect. 1673.Pp 1674Strings to program function keys can be given as 1675.Sy \&pk , 1676.Sy \&pl , 1677and 1678.Sy \&px . 1679Each of these strings takes two parameters: the function key number 1680to program (from 0 to 9) and the string to program it with. 1681Function key numbers out of this range may program undefined keys 1682in a terminal-dependent manner. 1683The differences among the capabilities are that 1684.Sy \&pk 1685causes pressing the given key to be the same as the user typing the given 1686string; 1687.Sy \&pl 1688causes the string to be executed by the terminal in local mode; 1689and 1690.Sy \&px 1691causes the string to be transmitted to the computer. 1692Unfortunately, due to lack of a definition for string parameters in 1693.Nm , 1694only 1695.Xr terminfo 5 1696supports these capabilities. 1697.Ss Glitches and Brain-damage 1698Hazeltine terminals, which do not allow `~' characters to be displayed, 1699should indicate 1700.Sy \&hz . 1701.Pp 1702The 1703.Sy \&nc 1704capability, now obsolete, formerly indicated Datamedia terminals, 1705which echo 1706.Sy \&\er \en 1707for 1708carriage return then ignore a following linefeed. 1709.Pp 1710Terminals that ignore a linefeed immediately after an 1711.Sy \&am 1712wrap, such as the Concept, should indicate 1713.Sy \&xn . 1714.Pp 1715If 1716.Sy \&ce 1717is required to get rid of standout 1718(instead of merely writing normal text on top of it), 1719.Sy \&xs 1720should be given. 1721.Pp 1722Teleray terminals, where tabs turn all characters moved over to blanks, 1723should indicate 1724.Sy \&xt 1725(destructive tabs). 1726This glitch is also taken to mean that it is not possible 1727to position the cursor on top of a \*(lqmagic cookie\*(rq, and that 1728to erase standout mode it is necessary to use delete and insert line. 1729.Pp 1730The Beehive Superbee, which is unable to correctly transmit the 1731.Dv ESC 1732or 1733.Sy \&^C 1734characters, has 1735.Sy \&xb , 1736indicating that the 1737.Dq \&f\&1 1738key is used for 1739.Dv ESC 1740and 1741.Dq \&f\&2 1742for ^C. 1743(Only certain Superbees have this problem, depending on the 1744.Tn ROM . ) 1745.Pp 1746Other specific terminal problems may be corrected by adding more 1747capabilities of the form 1748.Sy x Em x . 1749.Ss Similar Terminals 1750If there are two very similar terminals, 1751one can be defined as being just like the other with certain exceptions. 1752The string capability 1753.Sy \&tc 1754can be given 1755with the name of the similar terminal. 1756This capability must be 1757.Em last , 1758and the combined length of the entries 1759must not exceed 1024. 1760The capabilities given before 1761.Sy \&tc 1762override those in the terminal type invoked by 1763.Sy \&tc . 1764A capability can be cancelled by placing 1765.Sy \&xx@ 1766to the left of the 1767.Sy \&tc 1768invocation, where 1769.Sy \&xx 1770is the capability. 1771For example, the entry 1772.Bd -literal -offset indent 1773hn\||\|2621\-nl:ks@:ke@:tc=2621: 1774.Ed 1775.Pp 1776defines a 1777.Dq 2621\-nl 1778that does not have the 1779.Sy \&ks 1780or 1781.Sy \&ke 1782capabilities, 1783hence does not turn on the function key labels when in visual mode. 1784This is useful for different modes for a terminal, or for different 1785user preferences. 1786.Sh FILES 1787.Bl -tag -width /usr/share/misc/termcap.db -compact 1788.It Pa /usr/share/misc/termcap 1789File containing terminal descriptions. 1790.It Pa /usr/share/misc/termcap.db 1791Hash database file containing terminal descriptions (see 1792.Xr cap_mkdb 1 ) . 1793.El 1794.Sh SEE ALSO 1795.Xr cap_mkdb 1 , 1796.Xr ex 1 , 1797.Xr more 1 , 1798.Xr tset 1 , 1799.Xr ul 1 , 1800.Xr vi 1 , 1801.Xr curses 3 , 1802.Xr printf 3 , 1803.Xr termcap 3 , 1804.Xr terminfo 3 , 1805.Xr terminfo 5 , 1806.Xr term 7 1807.Sh HISTORY 1808The 1809.Nm 1810file format appeared in 1811.Bx 3 . 1812.Sh CAVEATS 1813The 1814.Nm 1815functions 1816were replaced by 1817.Xr terminfo 5 1818in 1819.At V 1820Release 2.0. 1821The transition will be relatively painless if capabilities flagged as 1822.Dq obsolete 1823are avoided. 1824.Sh BUGS 1825Lines and columns are now stored by the kernel as well as in the termcap 1826entry. 1827Most programs now use the kernel information primarily; the information 1828in this file is used only if the kernel does not have any information. 1829.Pp 1830Historically, the total length of a single entry (excluding only 1831escaped newlines) was limited to 1023 bytes, not including the NUL 1832terminator. 1833Larger entries may lead to a buffer overflow on some systems. 1834.Pp 1835Not all programs support all entries. 1836