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