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