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