1 04/15/88  TERMINFO
   2 
   3 Name:
   4 
   5 terminfo - terminal capability data base
   6 
   7 
   8 Synopsis:
   9 
  10 >sl3p>cc>e>terminfo>*>*
  11 
  12 
  13 Description:
  14 
  15 Terminfo is a data base describing terminals, used, e.g.  by vi
  16 and curses.  Terminals are described in terminfo by giving a set
  17 of capabilities which they have,and by describing how operations are
  18 performed.  Padding requirements and initialization sequences are
  19 included in terminfo.
  20 
  21 Entries in terminfo consist of a number of ',' separated.fields.
  22 White space after each ',' is ignored.  The first entry for each
  23 terminal gives the names which are known for the terminal, separated
  24 by '|' characters.  The first name given is the most common
  25 abbreviation for the terminal, the last name given should be a long
  26 name fully identifying the terminal, and all others are understood as
  27 
  28 
  29 synonyms for the terminal name.  All names but the last should be in
  30 lower case and contain no blanks; the last name may well contain
  31 upper case and blanks for readability.
  32 
  33 Terminal names (except for the last, verbose entry) should be chosen
  34 using the following conventions.  The particular piece of hardware
  35 making up the terminal should have a root name chosen, thus "hp2621".
  36 This name should not contain hyphens, except that synonyms may be
  37 chosen that do not conflict with other names.  Modes that the
  38 hardware can be in, or user preferences, should be indicated by
  39 appending a hyphen and an indicator of the mode.  Thus, a vt100 in
  40 132 column mode would be vt100-w.  The following suffixes should be
  41 used where possible:
  42 
  43 
  44 Suffix    Meaning                                 Example
  45 
  46 -w        Wide mode (more than 80 columns)        vt100-w
  47 -am       With auto. margins (usually default)    vt100-am
  48 -nam      Without automatic margins               vt100-nam
  49 -n        Number of lines on the screen           aaa-60
  50 -na       No arrow keys (leave them in local)     c100-na
  51 -np       Number of pages of memory               c100-4p
  52 -rv       Reverse video                           c100-rv
  53 
  54 
  55 Capabilities:
  56 
  57 The variable is the name by which the programmer (at the terminfo
  58 level) accesses the capabiltiy.  The capname is the short name used
  59 in the text of the database, and is used by a person updating the
  60 database.  The i.code is the two letter internal code used in the
  61 compiled database, and always corresponds to the old termcap
  62 capability name.
  63 
  64 Capability names have no hard length limit, but an informal limit of
  65 5 characters has been adopted to keep them short and to allow the
  66 tabs in the source file caps to line up nicely.  Whenever possible,
  67 names are chosen to be the same as or similar to the ANSI X3.64-1979
  68 standard.  Semantics are also intended to match those of the
  69 specification.
  70 
  71 
  72 (P)   indicates that padding may be specified
  73 
  74 (G)   indicates that the string is passed through tparm with parms
  75       as given (#i).
  76 
  77 (*)   indicates that padding may be based on the number of lines
  78       affected.
  79 
  80 (#i)  indicates the i th parameter.
  81 
  82 
  83      Variable          Cap-     I.        Description
  84      Booleans          name    Code
  85 
  86 auto_left_margin       bw       bw   cub1 wraps from column 0 to last
  87                                      column
  88 auto_right_margin      am       am   Terminal has automatic margins
  89 beehive_glitch         xsb      xb   Beehive (f1=escape, f2=ctrl C)
  90 ceol_standout_glitch   xhp      xs   Standout not erased by
  91                                      overwriting (hp)
  92 eat_newline_glitch     xenl     xn   newline ignored after 80 cols
  93                                      (Concept)
  94 erase_overstrike,      eo       eo   Can erase overstrikes with a blank
  95 generic_type           gn       gn   Generic line type  (e.g.,
  96                                      dialup, switch).
  97 hard_copy,             hc       hc   Hardcopy terminal
  98 
  99 
 100 has_meta_key           km       km   Has a meta key (shift, sets
 101                                      parity bit)
 102 has_status-line        hs       hs   Has extra "status line"
 103 insert_null_glitch     in       in   Insert mode distinguishes nulls
 104 memory_above           da       da   Display may be retained above
 105                                      the screen
 106 memory_below           db       db   Display may be retained below
 107                                      the screen
 108 move_insert_mode       mir      mi   Safe to move while in insert mode
 109 move_standout_mode     msgr     ms   Safe to move in standout modes
 110 over_strike            os       os   Terminal overstrikes
 111 status_line_esc_ok     eslok    es   Escape can be used on the status
 112                                      line
 113 teleray_glitch         xt       xt   Tabs ruin, magic so char
 114                                      (Teleray 1061)
 115 
 116 
 117 tilde_glitch           hz       hz   Hazeltine; can not print ~'s
 118 transparent_underline  ul       ul   underline character overstrikes
 119 xon_xoff               xon      xo   Terminal uses xon/xoff handshaking
 120 
 121 
 122 NUMBERS
 123 
 124 columns                cols     co   Number of columns in a line
 125 init_tabs              it       it   Tabs initially every # spaces
 126 lines                  lines    li   Number of lines on screen or page
 127 lines_of_memory        1m       1m   Lines of memory if > lines.
 128                                      0 means varies
 129 magic_cookie_glitch    xmc      sg   Number of blank chars left by
 130                                      smso or rmso
 131 
 132 
 133 padding_baud_rate      pb       pb   Lowest baud where cr/nl padding
 134                                      is needed
 135 virtual_terminal       vt       vt   Virtual terminal number (UNIX
 136                                      system)
 137 width_status_line      wsl      ws   No. columns in status line
 138 
 139 
 140 STRINGS
 141 
 142 back_tab               cbt      bt   Back tab (P)
 143 bell                   bel      bl   Audible signal (bell)
 144 carriage_return        cr       cr   Carriage return (P*)
 145 change_scroll_region   csr      cs   change to lines #1 through #2
 146                                      (vt100) (PG)
 147 clear_all-tabs         tbc      ct   Clear all tab stops (P)
 148 
 149 
 150 clear_screen           clear    cl   Clear screen and home cursor (P*)
 151 clr_eol                el       ce   Clear to end of line (P)
 152 clr_eos                ed       cd   Clear to end of display (P*)
 153 column_address         hpa      ch   Set cursor column (PG)
 154 command_character      cmdch    CC   Term. settable cmd char in
 155                                      prototype
 156 cursor_address         cup      cm   Screen rel. cursor motion row
 157                                      #1 col #2 (PG)
 158 cursor_down            cud1     do   Down one line
 159 cursor_home            home     ho   Home cursor (if no cup)
 160 cursor_invisible       civis    vi   Make cursor invisible
 161 cursor_left            cub1     le   Move cursor left one space
 162 cursor_mem_address     mrcup    CM   Memory relative cursor addressing
 163 cursor_normal          cnorm    ve   Make cursor appear normal
 164                                      (undo vs/vi)
 165 
 166 
 167 cursor_right           cufl     nd   Non-destructive space (cursor
 168                                      right)
 169 cursor_to_ll           ll       ll   Last line, first column (if no
 170                                      cup)
 171 cursor_up              cuul     up   Upline (cursor up)
 172 cursor_visible         cvvis    vs   Make cursor very visible
 173 delete_character       dch1     dc   Delete character (P*)
 174 delete_line            dl1      dl   Delete line (P*)
 175 dis_status_line        dsl      ds   Disable status line
 176 down_half_line         hd       hd   Half-line down (forward 1/2
 177                                      linefeed)
 178 enter_alt_charset     smacs     as   Start alternate character set (P)
 179   _mode
 180 enter_blink_mode      blink     mb   Turn on blinking
 181 enter_bold_mode       bold      md   Turn on bold (extra bright) mode
 182 
 183 
 184 enter_ca_mode         smcup     ti   String to begin programs that
 185                                      use cup
 186 enter_delete_mode     smdc      dm   Delete mode (enter)
 187 enter_dim_mode        dim       mh   Turn on half-bright mode
 188 enter_insert_mode     smir      im   Insert mode (enter)
 189 enter_protected_mode  prot      mp   Turn on protected mode
 190 enter_reverse_mode    rev       mr   Turn on reverse video mode
 191 enter_secure_mode     invis     mk   Turn on blank mode (chars
 192                                      invisible)
 193 enter_standout_mode   smso      so   Begin stand out mode
 194 enter_underline_mode  smul      us   Start underscore mode
 195 erase_chars           ech       ec   Erase #1 characters  (PG)
 196 exit_alt_charset_mode  rmacs    ae   End alternate character set (P)
 197 exit_attribute_mode   sgr0      me   Turn off all attributes
 198 
 199 
 200 exit_ca_mode          rmcup     te   String to end programs that use
 201                                      cup
 202 exit_delete_mode      rmdc      ed   End delete mode
 203 exit_insert_mode      rmir      ei   End insert mode
 204 exit_standout_mode    rmso      se   End stand out mode
 205 exit_underline_mode   rmul      ue   End underscore mode
 206 flash_screen          flash     vb   Visible bell (may not move
 207                                      cursor)
 208 form_feed             ff        ff   Hardcopy terminal page eject (P*)
 209 from_status_line      fsl       fs   Return from status line
 210 init_1string          is1       i1   Terminal initialization string
 211 init_2string          is2       i2   Terminal initilization string
 212 init_3string          is3       i3   Terminal initilization string
 213 init_file             if        if   Name of file containing is
 214 insert_character      ich1      ic   Insert character (P)
 215 
 216 
 217 insert_line           il1       al   Add new blank line  (P*)
 218 insert_padding        ip        ip   Insert pad after character
 219                                      inserted (P*)
 220 key_backspace         kbs       kb   Sent by backspace key
 221 key_catab             ktbc      ka   Sent by clear-all-tabs key
 222 key_clear             kclr      kC   Sent by clear screen or erase key
 223 key_ctab              kctab     kt   Sent by clear-tab key
 224 key_dc                kdch1     kD   Sent by delete character key
 225 key_dl                kdl1      kL   Sent by delete line key
 226 key_down              kcud1     kd   Sent by terminal down arrow key
 227 key_eic               krmir     kM   Sent by rmir on smir in insert
 228                                      mode
 229 key_eol               kel       kE   Sent by clear-to-end-of-line key
 230 key_eos               ked       kS   Sent by clear-to-end- of-screen
 231                                      key
 232 
 233 
 234 key_f0                kf0       k0   Sent by function key f0
 235 key_f1                kf1       k1   Sent by function key f1
 236 key_f10               kf10      ka   Sent by function key f10
 237 key_f2                kf2       k2   Sent by function key f2
 238 key_f3                kf3       k3   Sent by function key f3
 239 key_f4                kf4       k4   Sent by function key f4
 240 key_f5                kf5       k5   Sent by function key f5
 241 key_f6                kf6       k6   Sent by function key f6
 242 key_f7                kf7       k7   Sent by function key f7
 243 key_f8                kf8       k8   Sent by function key f8
 244 key_f9                kf9       k9   Sent by function key f9
 245 key_home              khome     kh   Sent by home key
 246 key_ic                kich1     kI   Sent by ins char/enter ins mode
 247                                      key
 248 key_il                kil1      kA   Sent by insert line
 249 
 250 
 251 key_left              kcub1     kl   Sent by terminal left arrow key
 252 key_ll                kll       kH   Sent by home-down key
 253 key_npage             knp       kN   Sent by next-page key
 254 key_ppage             kpp       kP   Sent by previous-page key
 255 key_right             kcuf1     kr   Sent by terminal right arrow key
 256 key_sf                kind      kF   Sent by scroll-forward/down key
 257 key_sr                kri       kR   Sent by scroll-backward/up key
 258 key_stab              khts      kT   Sent by set-tab key
 259 key_up                kcuu1     ku   Sent by terminal up arrow key
 260 keypad_local          rmkx      ke   Out of "keypad transmit" mode
 261 keypad_xmit           smkx      ks   Put terminal in "keypad transmit"
 262                                      mode
 263 lab_f0                lf0       l0   Labels on funct. key f0 if not f0
 264 lab_f1                lf1       l1   Labels on funct. key f1 if not f1
 265 
 266 
 267 lab_f10               lf10      la   Labels on function key f10 if not
 268                                      f10
 269 lab_f2                lf2       l2   Labels on funct. key f2 if not f2
 270 lab_f3                lf3       l3   Labels on funct. key f3 if not f3
 271 lab_f4                lf4       l4   Labels on funct. key f4 if not f4
 272 lab_f5                lf5       l5   Labels on funct. key f5 if not f5
 273 lab_f6                lf6       l6   Labels on funct. key f6 if not f6
 274 lab_f7                lf7       l7   Labels on funct. key f7 if not f7
 275 lab_f8                lf8       l8   Labels on funct. key f8 if not f8
 276 lab_f9                lf9       l9   Labels on funct. key f9 if not f9
 277 meta_on               smm       mm   Turn on "meta mode" (8th bit)
 278 meta_off              rmm       mo   Turn off "meta mode"
 279 newline               nel       nw   Newline (behaves like cr followed
 280                                      by lf)
 281 pad_char              pad       pc   Pad character (rather than null)
 282 
 283 
 284 parm_dch              dch       DC   Delete #1 chars (PG*)
 285 parm_delete_line      dl        DL   Delete #1 lines (PG*)
 286 parm_down_cursor      cud       DO   Move cursor down #1 lines (PG*)
 287 parm_ich              ich       IC   Insert #1 blank chars (PG*)
 288 parm_index            indn      SF   Scroll forward #1 lines (PG)
 289 parm_insert_line      il        AL   Add #1 new blank lines (PG*)
 290 parm_left_cursor      cub       LE   Move cursor left #1 spaces (PG)
 291 parm_right_cursor     cuf       RI   Move cursor right #1 spaces (PG*)
 292 parm_rindex           rin       SR   Scroll backward #1 lines (PG)
 293 parm_up_cursor        cuu       UP   Move cursor up #1 lines (PG*)
 294 pkey_key              pfkey     pk   Prog funct key #1 to type
 295                                      string #2
 296 pkey_local            pfloc     pl   Prog funct key #1 to execute
 297                                      string #2
 298 
 299 
 300 pkey_xmit             pfx       px   Prog funct key #1 to xmit
 301                                      string #2
 302 print_screen          mc0       ps   Print contents of the screen
 303 prtr_off              mc4       pf   Turn off the printer
 304 prtr_on               mc5       po   Turn on the printer
 305 repeat_char           rep       rp   Repeat char #1 #2 times (PG*)
 306 reset_1string         rs1       r1   Reset terminal completely to sane
 307                                      modes.
 308 reset_2string         rs2       r2   Reset terminal completely to sane
 309                                      modes.
 310 reset_3string         rs3       r3   Reset terminal completely to sane
 311                                      modes.
 312 reset_file            rf        rf   Name of file containing reset
 313                                      string
 314 
 315 
 316 restore_cursor        rc        rc   Restore cursor to position of
 317                                      last sc
 318 row_address           vpa       cv   Vertical position absolute (set
 319                                      row)(PG)
 320 save_cursor           sc        sc   Save cursor position (P)
 321 scroll_forward        ind       sf   Scroll text up (P)
 322 scroll_reverse        ri        sr   Scroll text down (P)
 323 set_attributes        sgr       sa   Define the video attributes (PG9)
 324 
 325 set_tab               hts       st   Set a tab in all rows, current
 326                                      column
 327 set_window            wind      wi   Current window is lines #1-#2
 328                                      cols #3-#4
 329 tab                   ht        ta   Tab to next 8 space hardware tab
 330                                      stop
 331 
 332 
 333 to_status_line        tsl       ts   Go to status line, column #1
 334 underline_char        uc        uc   Underscore one char and move past
 335                                      it
 336 up_half_line          hu        hu   Half-line up (reverse 1/2
 337                                      linefeed)
 338 init_prog             iprog     iP   Path name of program for init
 339 key_a1                ka1       k1   Upper left of keypad
 340 key_a3                ka3       k3   Upper right of keypad
 341 key_b2                kb2       K2   Center of keypad
 342 key_c1                kc1       K4   Lower left of keypad
 343 key_c3                kc3       K5   Lower right of keypad
 344 prtr_non              mc5p      pO   Turn on the printer for #1 bytes
 345 
 346 
 347 A Sample Entry:
 348 
 349 The following entry, which describes the Concept-100, is among the
 350 more complex entries in the terminfo file as of this writing.
 351 
 352 concept100 | c100 | concept | c104 | c100-4p | concept 100,
 353           am, bel=^G, blank=\EH, blink=\EC, clear=^L$<2*>, cnorm=\Ew,
 354           cols#80, cr=^M$<9>, cub1=^H, cud1=^J, cuf1=\E=,
 355           cup=\Ea%p1%' '%+%c%p2%' '%+%c, cuu1=\E;, cvvis=\EW, db,
 356           dch1=\E^A$<16*>, dim=\EE, dl1=\E^B$<3*>, ed=\E^C$<16*>,
 357           el=\E^U$<16>, eo, flash=\Ek$<20>\EK, ht=\t$<8>,
 358           il1=\E^R$<3*>, in, ind=^J, .ind=^J$<9>, ip=$<16*>,
 359           is2=\EU\Ef\E7\E5\E8\El\ENH\EK\E\200\Eo&\200\Eo\47\E,
 360 
 361 
 362           kbs=^h, kcub1=\E>, kcud1=\E<, kcuf1=\E=, kcuu1=\E;,
 363           kf1=\E5, kf2=\E6, kf3=\E7, khome=\E?,
 364           lines#24, mir, pb#9600, prot=\EI,
 365           rep=\Er%p1%c%p2%' '%+%c$<.2*>, rev=\ED,
 366           rmcup=Ev   $<6>\Ep\r\n, rmir=\E\200, rmkx=\Ex, rmso=\Ed\Ee,
 367           rmul=\Eg, rmul=\Eg, sgr0=\EN\200, smcup=\EU\Ev  8p\Ep\r,
 368           smir=\E^P, smkx=\EX, smso=\EE\ED, smul=\EG, tabs,
 369           ul  vt#8, xenl,
 370 
 371 
 372 Entries may continue onto multiple lines by placing white space at
 373 the beginning of each line except the first.  Comments may be
 374 included on lines beginning with "#".  Capabilities in terminfo are
 375 of three types: Boolean capabilities which indicate that the terminal
 376 has some particular feature, numeric capabilities giving the size of
 377 the terminal or the size of particular delays, and string
 378 capabilities, which give a sequence which can be used to perform
 379 particular terminal operations.
 380 
 381 
 382 Types of Capabilities:
 383 
 384 All capabilities have names.  For instance, the fact that Concept has
 385 automatic margins (i.e., an automatic return and linefeed when the
 386 end of a line is reached) is indicated by the capability am.  Hence
 387 the description of the Concept includes am.  Numeric capabilities are
 388 followed by the character '#' and then the value.  Thus cols, which
 389 indicates the number of columns the terminal has, gives the value
 390 '80' for the Concept.
 391 
 392 Finally, string valued capabilities, such as el (clear to end of line
 393 sequence) are given by the two-character code, '=', and then a string
 394 ending at the next following ','.  A delay in milliseconds may appear
 395 anywhere in such a capability, enclosed in $<..> brackets, as in
 396 el=\EK$<3>, and padding characters are supplied by tputs to provide
 397 
 398 
 399 this delay.  The delay can be either a number, e.g.  '20', or a
 400 number followed by an '*', i.e., '3*'.  A '*' indicates that the
 401 padding required is proportional to the number of lines affected by
 402 the operation, and the amount given is the per-affected-unit padding
 403 required.  (In the case of insert character, the factor is still the
 404 number of lines affected.  This is always one unless the terminal has
 405 xenl and the software uses it.) When a '*' is specified, it is
 406 sometimes useful to give a delay of the form '3.5' to specify a delay
 407 per unit to tenths of milliseconds.  (Only one decimal place is
 408 allowed.)
 409 
 410 A number of escape sequences are provided in the string valued
 411 capabilities for easy encoding of characters there.  Both \E and \e
 412 map to an ESCAPE character, ^x maps to a control-x for any
 413 appropriate x, and the sequences \n \l \r \t \b \f \s give a newline,
 414 
 415 
 416 linefeed, return, tab, backspace, formfeed, and space.  Other escapes
 417 include \^ for ^, \\ for \, \ for comma, \: for :, and \0 for null.
 418 (\0 will produce \200, which does not terminate a string but behaves
 419 as a null character on most terminals.) Finally, characters may be
 420 given as three octal digits after a\.
 421 
 422 Sometimes individual capabilities must be commented out.  To do this,
 423 put a period before the capability name.  For example, see the second
 424 ind in the example above.
 425 
 426 
 427 Preparing Descriptions:
 428 
 429 We now outline how to prepare descriptions of terminals.  The most
 430 effective way to prepare a terminal description is by imitating the
 431 description of a similar terminal in terminfo and to build up a
 432 description gradually, using partial descriptions with vi to check
 433 that they are correct.  Be aware that a very unusual terminal may
 434 expose deficiencies in the ability of the terminfo file to describe
 435 it or bugs in vi.  To easily test a new terminal description you can
 436 set the environment variable TERMINFO to a pathname of a directory
 437 containing the compiled description you are working on and programs
 438 will look there rather than in >sl3p>cc>e>terminfo.  To get the padding
 439 
 440 
 441 for insert line right (if the terminal manufacturer did not document
 442 it) a severe test is to edit /etc/ passwd at 9600 baud, delete 16 or
 443 so lines from the middle of the screen, then hit the 'u' key several
 444 times quickly.  If the terminal messes up, more padding is usually
 445 needed.  A similar test can be used for insert character.
 446 
 447 
 448 Basic Capabilities:
 449 
 450 The number of columns on each line for the terminal is given by the
 451 cols numeric capability.  If the terminal is a CRT, then the number
 452 of lines on the screen is given by the lines capability.  If the
 453 terminal wraps around the beginning of the next line when it reaches
 454 the right margin, then it should have the am capability.  If the
 455 terminal can clear its screen, leaving the cursor in the home
 456 position, then this is given by the clear string capability.  If the
 457 terminal overstrikes (rather than clearing a position when a
 458 character is struck over) then it should have the os capability.  If
 459 the terminal is a printing terminal, with no soft copy unit, give it
 460 both hc and os.  (os applies to storage scope terminals.) If there is
 461 a code to move the cursor to the left edge of the current row, give
 462 this as cr.  (Normally this will be carriage return, control M.) If
 463 
 464 
 465 there is a code to produce an audible signal (bell, beep, etc) give
 466 this as bel.
 467 
 468 If there is a code to move the cursor one position to the left (such
 469 as backspace) that capabiltiy should be given as cub1.  Similarly,
 470 codes to move to the right, up, and down should be given as cuf1,
 471 cuu1, and cud1.  These local cursor motions should not alter the text
 472 they pass over, for example, you would not normally use 'cuf1='
 473 because the space would erase the character moved over.  A very
 474 important point here is that the local cursor motions encoded in
 475 terminfo are undefined at the left and top edges of a CRT terminal.
 476 Programs should never attempt to backspace around the left edge,
 477 unless bw is given, and never attempt to go up locally off the top.
 478 In order to scroll text up, a program will go to the bottom left
 479 corner of the screen and send the ind (index) string.
 480 
 481 
 482 To scroll text down, a program goes to the top left corner of the
 483 screen and sends the ri (reverse index) string.  The strings ind and
 484 ri are undefined when not on their respective corners of the screen.
 485 
 486 Parameterized versions of the scrolling sequences are indn and rin
 487 which have the same semantics as ind and ri except that they take one
 488 parameter, and scroll that many lines.  They are also undefined
 489 except at the appropreate edge of the screen.
 490 
 491 The am capability tells whether the cursor sticks at the right edge
 492 of the screen when text is output, but this does not necessarily
 493 apply to a cuf1 from the last column.  The only local motion which is
 494 defined from the left edge is if bw is given, then a cub1 from the
 495 left edge will move to the right edge of the previous row.  If bw is
 496 not given, the effect is undefined.  This is useful for drawing a box
 497 
 498 
 499 around the edge of the screen, for example.  If the terminal has a
 500 switch selectable automatic margins, the terminfo file usually
 501 assumes that this is on; i.e., am.  If the terminal has a command
 502 which moves to the first column of the next line, that command can be
 503 given as nel (newline).  It does not matter if the command clears the
 504 remainder of the current line, so if the terminal has no cr and lf it
 505 may still be possible to craft a working nel out of one or both of
 506 them.
 507 
 508 
 509 These capabilities suffice to describe hardcopy and glass-tty
 510 terminals.  Thus the model 33 teletype is described as
 511 
 512 33|tty33|tty|model  33  teletype
 513 bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,
 514 
 515 while the Lear Siegler ADM-3 is described as
 516 
 517 adm3|3|1si  adm3
 518 am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
 519 ind=^J, lines#24,
 520 
 521 
 522 Parameterized Strings:
 523 
 524 Cursor addressing and other strings requiring parameters in the
 525 terminal are described by a parameterized string capability, with
 526 printf like escapes %x in it.  For example, to address the
 527 cursor, the cup capability is given, using two parameters: the row
 528 and column to address to.  (Rows and columns are numbered from zero
 529 and refer to the physical screen visable to the user not to any
 530 unseen memory.) If the terminal has memory relative cursor
 531 addressing, that can be indicated by mrcup.
 532 
 533 The parameter mechanism uses a stack and special % codes to
 534 manipulate it.  Typically a sequence will push one of the parameters
 535 onto the stack and then print it in some format.  Often more complex
 536 operations are necessary.
 537 
 538 
 539 The % encodings have the following meanings:
 540 
 541       %%             outputs '%'
 542       %d             print pop() as in printf
 543       %2d            print pop() like %2d
 544       %3d            print pop() like %3d
 545       %02d
 546       %03d           as in printf
 547       %c             print pop() gives %c
 548       %s             print pop() gives %s
 549 
 550 
 551       %p[1-9]        push ith parm
 552       %P[a-z]        set variable [a-z] to pop()
 553       %g[a-z]        get variable [a-z] and push it
 554       %'c'           char constant c
 555       %{nn}          integer constant nn
 556 
 557    %+ %- %* %/ %m    arithmetic (%m is mod): puch(pop() op pop())
 558 
 559       %& %| %^       bit operations: push (pop() op pop())
 560       %= %> %<       logical operations: push (pop() op pop ())
 561       %! %~          unary operations push (op pop())
 562       %i             add 1 to first two parms (for ANSI terminals)
 563 
 564 
 565    %? expr %t thenpart %e elsepart %;
 566                      if-then-else, %e elsepart is optional.
 567                      else-if's are possible ala Algol 68:
 568                      %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4
 569                         %t b4 %e %;
 570                      c(c1...cn) are conditions, b(b1...bn) are
 571                      bodies.
 572 
 573 Binary operations are in postfix form with the operands in the usual
 574 order.  That is, to get x-5 one would use "%gx%{5}%-".
 575 
 576 
 577 Consider the Hewlett-Packard 2645, which to get to row 3 and column
 578 12, needs to be sent \E&a12c03Y padded for 6 milliseconds.  Note that
 579 the order of the rows and columns is inverted here, and that the row
 580 and column are printed as two digits.  Thus its cup capability is
 581 cup=6\E&%p2%2dc%p1%2dY.
 582 
 583 The Microterm ACT-IV needs the current row and column sent preceded
 584 by a ^T, with the row and column simply encoded in binary,
 585 cut=^T%p1%c%p2%c.  Terminals which use %c need to be able to
 586 backspace the cursor (cub1), and to move the cursor up one line on
 587 the screen (cuu1).  This is necessary because it is not always safe
 588 to transmit \n ^D and \r, as the system may change or discard them.
 589 (The library routines dealing with terminfo set tty modes so that
 590 tabs are never expanded, so \t is safe to send.  This turns out to be
 591 essential for the Ann Arbor 4080.)
 592 
 593 
 594 A final example is the LSI ADM-3a, which uses row and column offset
 595 by a blank character, thus cup=\E=%p1%' '%+%c%p2%' '%+%c.  After
 596 sending '\E=', this pushes the first parameter, pushes the ASCII
 597 value for a space (32), adds them (pushing the sum on the stack in
 598 place of the two previous values) and outputs that value as a
 599 character.  Then the same is done for the second parameter.  More
 600 complex arithmetic is possible using the stack.
 601 
 602 
 603 If the terminal has row or column absolute cursor addressing, these
 604 can be given as single parameter capabilities hpa (horizontal
 605 position absolute) and vpa (vertical position absolute).  Sometimes
 606 these are shorter than the more general two parameter sequence (as
 607 with the hp2645) and can be used in preference to cup.  If there are
 608 parameterized local motions (e.g., move n spaces to the right) these
 609 can be given as cud, cub, cuf, and cuu with a single parameter
 610 indicating how many spaces to move.  These are primarily useful if
 611 the terminal does not have cup, such as the TEKTRONIX 4025.
 612 
 613 
 614 Cursor Motions:
 615 
 616 If the terminal has a fast way to home the cursor (to the very upper
 617 left corner of screen) then this can be given as home; similarly a
 618 fast way of getting to the lower left-hand corner can be given as ll;
 619 this may involve going up with cuu1 from the home position, but a
 620 program should never do this itself (unless ll does) because it can
 621 make no assumption about the effect of moving up from the home
 622 position.  Note that the home position is the same as addressing to
 623 (0,0): to the top left corner of the screen, not of memory.  (Thus,
 624 the \EH sequence on Hewlett-Packard terminals cannot be used for
 625 home.)
 626 
 627 
 628 Area Clears:
 629 
 630 If the terminal can clear from the current position to the end of the
 631 line, leaving the cursor where it is, this should be given as el.  If
 632 the terminal can clear from the current position to the end of the
 633 display, then this should be given as ed.  Ed is only defined from
 634 the first column of a line.  (Thus , it can be simulated by a request
 635 to delete a large number of lines, if a true ed is not available.)
 636 
 637 
 638 Insert/delete line:
 639 
 640 If the terminal can open a new blank line before the line where the
 641 cursor is, this should be given as il1; this is done only from the
 642 first position of a line.  The cursor must then appear on the newly
 643 blank line.  If the terminal can delete the line which the cursor is
 644 on, then this should be given as dl1; this is done only from the
 645 first position on the line to be deleted.  Versions of il1 and dl1
 646 which take a single parameter and insert or delete that many lines
 647 can be given as il and dl.  If the terminal has a settable scrolling
 648 region (like the vt100) the command to set this can be described with
 649 the csr capability which takes two parameters: the top and bottom
 650 lines of the scrolling region.  The cursor position is, alas,
 651 undefined after using this command.  It is possible to get the effect
 652 of insert or delete line using this command - the sc and rc (save and
 653 
 654 
 655 restore cursor) commands are also useful.  Inserting lines at the top
 656 or bottom of the screen can also be done using ri and ind on many
 657 terminals without true insert/delete line, and is often faster even
 658 on terminals with those features.
 659 
 660 If the terminal has the ability to define a window as part of memory,
 661 which all commands affect, it should be given as the parameterized
 662 string wind.  The four parameters are the starting and ending lines
 663 in memory and the starting and ending columns in memory, in that
 664 order. If the terminal can retain display memory above, then the da
 665 capability should be given; if display memory can be retained below,
 666 then db should be given.  These indicate that deleting a line or
 667 scrolling may bring non-blank lines up from below or that scrolling
 668 back with ri may bring down non-blank lines.
 669 
 670 
 671 Insert/Delete Character:
 672 
 673 There are two basic kinds of intelligent terminals with respect to
 674 insert/delete character which can be described using terminfo.  The
 675 most common insert/delete character operations affect only the
 676 characters on the current line and shift characters off the end of
 677 the line rigidly.  Other terminals, such as the Concept 100 and the
 678 Perkin Elmer Owl, make a distinction between typed and untyped blanks
 679 on the screen, shifting upon an insert or delete only to an untyped
 680 blank on the screen which is either eliminated, or expanded to two
 681 untyped blanks.  You can determine the kind of terminal you have by
 682 clearing the screen and then typing text separated by cursor motions.
 683 Type abc def using local cursor motions (not spaces) between the abc
 684 and the def.  Then position the cursor before the abc and put the
 685 terminal in insert mode.  If typing characters causes the rest of the
 686 
 687 
 688 line to shift rigidly and characters to fall off the end, then your
 689 terminal does not distinguish between blanks and untyped positions.
 690 If the abc shifts over to the def which then move together around the
 691 end of the current line and onto the next as you insert, you have the
 692 second type of terminal, and should give the capability in, which
 693 stands for insert null.  While these are two logically separate
 694 attributes (one line vs.  multiline insert mode, and special
 695 treatment of untyped spaces) we have seen no terminals whose insert
 696 mode cannot be described with the single attribute.
 697 
 698 Terminfo can describe both terminals which have an insert mode, and
 699 terminals which send a simple sequence to open a blank position on
 700 the current line.  Give as smir the sequence to get into insert mode.
 701 Give as rmir the sequence to leave insert mode.  Now give as ich1 any
 702 sequence needed to be sent just before sending the character to be
 703 
 704 
 705 inserted.  Most terminals with a true insert mode will not give ich1;
 706 terminals which send a sequence to open a screen position should give
 707 it here.  (If your terminal has both, insert mode is usually
 708 preferable to ich1.  Do not give both unless the terminal actually
 709 requires both to be used in combination.) If post insert padding is
 710 needed, give this as a number of milliseconds in ip (a string
 711 option).  Any other sequence which may need to be sent after an
 712 insert of a single character may also be given in ip.  If your
 713 terminal needs both to be placed into an 'insert mode' and a special
 714 code to precede each inserted character, then both smir/rmir and ich1
 715 can be given, and both will be used.  The ich capability, with one
 716 parameter, n, will repeat the effects of ich1 n times.
 717 
 718 
 719 It is occasionally necessary to move around while in insert mode to
 720 delete characters on the same line (e.g., if there is a tab after the
 721 insertion position).  If your terminal allows motion while in insert
 722 mode you can give the capability mir to speed up inserting in this
 723 case.  Omitting mir will affect only speed.  Some terminals (notably
 724 Datamedia's) must not have mir because of the way their insert mode
 725 works.
 726 
 727 Finally, you can specify dch1 to delete a single character, dch with
 728 one parameter, n, to delete n characters, and delete mode by giving
 729 smdc and rmdc to enter and exit delete mode (any mode the terminal
 730 needs to be placed in for dch1 to work).
 731 
 732 A command to erase n characters (equivilent to outputting n blanks
 733 without moving the cursor) can be given as ech with one parameter.
 734 
 735 
 736 Highlighting, Underlining, and Visable Bells:
 737 
 738 If your terminal has one or more kinds of display attributes, these
 739 can be represented in a number of different ways.  You should choose
 740 one display form as standout mode, representing a good, high
 741 contrast, easy-on-the-eyes, format for highlighting error messages
 742 and other attention getters.  (If you have a choice, reverse video
 743 plus half-bright is good, or reverse video alone.) The sequences to
 744 enter and exit standout mode are given as smso and rmso,
 745 respectively.  If the code to change into or out of standout mode
 746 leaves one or even two blank spaces on the screen, as the TVI 912 and
 747 Teleray 1061 do, then xmc should be given to tell how many spaces are
 748 left.
 749 
 750 
 751 Codes to begin underlining and end underlining can be given as smul
 752 and rmul respectively.  If the terminal has a code to underline the
 753 current character and move the cursor one space to the right, such as
 754 the Microterm Mime, this can be given as uc.
 755 
 756 Other capabilities to enter various highlighting modes include blink
 757 (blinking) bold (bold or extra bright) dim (dim or half-bright) invis
 758 (blanking or invisible text) prot (protected) rev (reverse video)
 759 sgr0 (turn off all attribute modes) smacs (enter alternate character
 760 set mode) and rmacs (exit alternate character set mode).  Turning on
 761 any of these modes singly may or may not turn off other modes.
 762 
 763 If there is a sequence to set arbitrary combinations of modes, this
 764 should be given as sgr (set attributes), taking 9 parameters.  Each
 765 parameter is either 0 or 1, as the corresponding attribute is on or
 766 
 767 
 768 off.  In order, the 9 parameters are  standout, underline, reverse,
 769 blink, dim, bold, blank, protect, alternate character set.  Not all
 770 modes need be supported by sgr, only those for which corresponding
 771 separate attribute commands exist.
 772 
 773 Terminals with the "magic cookie" glitch (xmc) deposit special
 774 "cookies" when they recieve mode-setting sequences, which affect the
 775 display algorithm rather than having extra bits for each character.
 776 Some terminals, such as the Hewlett-Packard 2621, automatically leave
 777 standout mode when they move to a new line or the cursor is
 778 addressed.  Programs using standout mode should exit standout mode
 779 before moving the cursor or sending a newline, unless the msgr
 780 capability, asserting that it is safe to move in standout mode, is
 781 present.
 782 
 783 
 784 If the terminal has a way of flashing the screen to indicate an error
 785 quietly (a bell replacement) then this can be given as flash; it must
 786 not move the cursor.  If the cursor needs to be made more visible
 787 than normal when it is not on the bottom line (to make, for example,
 788 a non-blinking underline into an easier to find block or blinking
 789 underline) give this sequence as cvvis.  If there is a way to make
 790 the cursor completely invisible, give that as civis.  The capability
 791 cnorm should be given which undoes the effects of both of these
 792 modes.
 793 
 794 
 795 If the terminal needs to be in a special mode when running a program
 796 that uses these capabilities, the codes to enter and exit this mode
 797 can be given as smcup and rmcup.  This arises, for example, from
 798 terminals like the Concept with more than one page of memory.  If the
 799 terminal has only memory relative cursor addressing and not screen
 800 relative cursor addressing, a one screen-sized window must be fixed
 801 into the terminal for cursor addressing to work properly.  This is
 802 also used for the TEKTRONIX 4025, where smcup sets the command
 803 character to be the one used by terminfo.
 804 
 805 
 806 Keypad:
 807 
 808 If the terminal has a keypad that transmits codes when the keys are
 809 pressed, this information can be given.  Note that it is not possible
 810 to handle terminals where the keypad only works in local (this
 811 applies, for example, to the unshifted Hewlett-Packard 2621 keys).
 812 If the keypad can be set to transmit or not transmit, give these
 813 codes as smkx and rmkx.  Otherwise the keypad is assumed to always
 814 transmit.  The codes sent by the left arrow, right arrow, up arrow,
 815 down arrow, and home keys can be given as kcub1, kcuf1, kcuu1, kcud1,
 816 and khome respectively.  If there are function keys such as f0, f1,
 817 ..., f10, the codes they send can be given as kf0, kf1, ..., kf10.
 818 If these keys have labels other than the default f0 through f10, the
 819 labels can be given as lf0, lf1, ..., lf10.  The codes transmitted by
 820 certain other special keys can be given: kll (home down), kbs
 821 
 822 
 823 (backspace), ktbc (clear all tabs), kctab (clear the tab stop in this
 824 column), kclr (clear screen or erase key), kdch1 (delete character),
 825 kdl1 (delete line), krmir (exit insert mode), kel (clear to end of
 826 line), ked (clear to end of screen), kich1 (insert character or enter
 827 insert mode), kil1(insert line), knp (next page), kpp (previous
 828 page), kind (scroll forward/down), kri (scroll backward/up), khts
 829 (set a tab stop in this column).  In addition, if the keypad has a 3
 830 by 3 array of keys including the four arrow keys, the other five keys
 831 can be given as ka1, ka3, kb2, kc1, and kc3.  These keys are useful
 832 when the effects of a 3 by 3 directional pad are needed.
 833 
 834 
 835 Tabs and Initialization:
 836 
 837 If the terminal has hardware tabs, the command to advance to the next
 838 tab stop can be given as ht (usually control I).  A "backtab" command
 839 which moves leftward to the next tab stop can be given as cbt.  By
 840 convention, if the teletype modes indicate that tabs are being
 841 expended by the computer rather than being sent to the terminal,
 842 programs should not use ht or cbt even if they are present, since the
 843 user may not have the tab stops properly set.  If the terminal has
 844 hardware tabs which are initially set every n spaces when the
 845 terminal is powered up, the numeric parameter it is given, showing
 846 the number of spaces the tabs are set to.  This is normally used by
 847 the tset command to determine whether to set the mode for hardware
 848 tab expansion, and whether to set the tab stops.  If the terminal has
 849 
 850 
 851 tab stops that can be saved in nonvolatile memory, the terminfo
 852 description can assume that they are properly set.
 853 
 854 Other capabilities include is1, is2, and is3, initialization strings
 855 for the terminal, iprog, the path name of a program to be run to
 856 initialize the terminal, and 'if', the name of a file containing long
 857 initialization strings.  These strings are expected to set the
 858 terminal into modes consistent with the rest of the terminfo
 859 description.  They are normally sent to the terminal, by the tset
 860 program, each time the user logs in.  They will be printed in the
 861 following order: is1; is2; setting tabs using tbc and hts; if;
 862 running the program iprog; and finally is3.  Most initialization is
 863 done with is2.  Special terminal modes can be set up without
 864 duplicating strings by putting the common sequences in is2 and
 865 special cases in is1 and is3.  A pair of sequences that does a harder
 866 
 867 
 868 reset from a totally unknown state can be analogously given as rs1,
 869 rs2, rf, and rs3, analogous to is2 and if.  These strings are output
 870 by the reset program, which is used when the terminal gets into a
 871 wedged state.  Commands are normally placed in rs2 and rf only if
 872 they produce annoying effects on the screen and are not necessary
 873 when logging in.  For example, the command to set the vt100 into 80-
 874 column mode would normally be part of is2, but it causes an annoying
 875 glitch of the screen and is not normally needed since the terminal is
 876 usually already in 80 column mode.
 877 
 878 If there are commands to set and clear tab stops, they can be given
 879 as tbc (clear all tab stops) and hts (set a tab stop in the current
 880 column of every row).  If a more complex sequence is needed to set
 881 the tabs than can be described by this, the sequence can be placed in
 882 is2 or if.
 883 
 884 
 885 Delays:
 886 
 887 Certain capabilities control padding in the teletype driver.  These
 888 are primarily needed by hard copy terminals, and are used by the tset
 889 program to set teletype modes appropriately.  Delays embedded in the
 890 capabilities cr, ind, cub1, ff, and tab will cause the appropriate
 891 delay bits to be set in the teletype driver.  If pb (padding baud
 892 rate) is given, these values can be ignored at baud rates below the
 893 value of pb.
 894 
 895 
 896 Miscellaneous:
 897 
 898 If the terminal requires other than a null (zero) character as a pad,
 899 then this can be given as pad, Only the first character of the pad
 900 string is used.
 901 
 902 If the terminal has an extra "status line" that is not normally used
 903 by software, this fact can be indicated.  If the status line is
 904 viewed as an extra line below the bottom line, into which one can
 905 cursor address normally (such as the Heathkit h19's 25th line, or the
 906 24th line of a vt100 which is set to a 23-line scrolling region), the
 907 capability hs should be given.  Special strings to go to the
 908 beginning of the status line and to return from the status line can
 909 be given as tsl and fsl.  (fsl must leave the cursor position in the
 910 same place it was before tsl.  If necessary, the sc and rc strings
 911 
 912 
 913 can be included in tsl and fsl to get this effect.) The parameter tsl
 914 takes one parameter, which is the column number of the status line
 915 the cursor is to be moved to.  If escape sequences and other special
 916 commands, such as tab, work while in the status line, the flag eslok
 917 can be given.  A string which turns off the status line (or otherwise
 918 erases its contents) should be given as dsl.  If the terminal has
 919 commands to save and restore the position of the cursor, give them as
 920 sc and rc.  The status line is normally assumed to be the same width
 921 as the rest of the screen, e.g., cols.  If the status line is a
 922 different width (possibly because the terminal does not allow an
 923 entire line to be loaded) the width, in columns, can be indicated
 924 with the numeric parameter wsl.
 925 
 926 
 927 If the terminal can move up or down half a line, this can be
 928 indicated with hu (half-line up) and hd (half-line down).  This is
 929 primarily useful for superscripts and subscripts on hardcopy
 930 terminals.  If a hardcopy terminal can eject to the next page (form
 931 feed), give this as ff (usually control L).
 932 
 933 If there is a command to repeat a given character a given number of
 934 times ( to save time transmitting a large number of identical
 935 characters) this can be indicated with the parameterized string rep.
 936 The first parameter is the character to be repeated and the second is
 937 the number of times to repeat it.  Thus, tparm (repeat_char, 'x', 10)
 938 is the same as 'xxxxxxxxxx'.
 939 
 940 If the terminal has a settable command character, such as the
 941 TEKTRONIX 4025, this can be indicated with cmdch.  A prototype
 942 
 943 
 944 command character is chosen which is used in all capabilities.  This
 945 character is given in the cmdch capability to identify it.  The
 946 following convention is supported on some UNIX systems: The
 947 environment is to be searched for a CC variable, and if found, all
 948 occurrences of the prototype character are replaced with the
 949 character in the environment variable.
 950 
 951 Terminal descriptions that do not represent a specific kind of known
 952 terminal, such as switch, dialup, patch, and network, should include
 953 the gn (generic) capability so that programs can complain that they
 954 do not know how to talk to the terminal.  (This capability does not
 955 apply to virtual terminal descriptions for which the escape sequences
 956 are known).
 957 
 958 
 959 If the terminal uses xon/xoff handshaking for flow control, give xon.
 960 Padding information should still be included so that routines can
 961 make better decisions about costs, but actual pad characters will not
 962 be transmitted.
 963 
 964 If the terminal has more lines of memory than will fit on the screen
 965 at once, the number of lines of memory can be indicated with lm.  A
 966 value of lm#0 indicates that the number of lines is not fixed, but
 967 that there is still more memory than fits on the screen.
 968 
 969 If the terminal is one of those supported by the UNIX system virtual
 970 terminal protocol, the terminal number can be given as vt.
 971 
 972 Media copy strings which control an auxiliary printer connected to
 973 the terminal can be given as mc0: print the contents of the screen,
 974 
 975 
 976 mc4: turn off the printer, and mc5: turn on the printer.  When the
 977 printer is on, all text sent to the terminal will be sent to the
 978 printer.  It is undefined whether the text is also displayed on the
 979 terminal screen when the printer is on.  A variation mc5p takes one
 980 parameter, and leaves the printer on for as many characters as the
 981 value of the parameter, then turns the printer off.  The parameter
 982 should not exceed 255.  All text, including mc4, is transparently
 983 passed to the printer while an mc5p is in effect.
 984 
 985 
 986 Strings to program function keys can be given as pfkey, pfloc, and
 987 pfx.  Each of these strings takes two parameters: the function key
 988 number to program (from 0 - 10) and the string to program it with.
 989 Function key numbers out of this range may program undefined keys in
 990 a terminal dependent manner.  The difference between the capabilities
 991 is that pfkey causes pressing the given key to be the same as the
 992 user typing the given string; pfloc causes the string to be executed
 993 by the terminal in local; and pfx causes the string to be transmitted
 994 to the computer.
 995 
 996 
 997 Glitches and Braindamage:
 998 
 999 Haseltine teminals, which do not allow '~' characters to be displayed
1000 should indicate hz.
1001 
1002 Terminals which ignore a linefeed immediately after an am wrap, such
1003 as the Concept and vt100, should indicate xenl.
1004 
1005 If el is required to get rid of standout (instead of merely writing
1006 normal text on top of it), xhp should be given.
1007 
1008 
1009 Teleray terminals, where tabs turn all characters moved over to
1010 blanks, should indicate xt (destructive tabs).  This glitch is also
1011 taken to mean that it is not possible to position the cursor on top
1012 of a "magic cookie", that to erase standout mode it is instead
1013 necessary to use delete and insert line.
1014 
1015 The Beehive Superbee, which is unable to correctly transmit the
1016 escape or control C characters, has xsb, indicating that the f1 key
1017 is used for escape and f2 for control C.  (Only certain Superbees
1018 have this problem, depending on the ROM.)
1019 
1020 Other specific terminal problems may be corrected by adding more
1021 capabilities of the form xx.
1022 
1023 
1024 Similar Terminals:
1025 
1026 If there are two very similar terminals, one can be defined as being
1027 just like the other with certain exceptions.  The string capability
1028 use can be given with the name of the similar terminal.  The
1029 capabilities given before use override those in the terminal type
1030 invoked by use.  A capability can be cancelled by placing xx@ to the
1031 left of the capability definition, where xx is the capability.  For
1032 example, the entry
1033                      2621-nl, smkx@, rmkx@, use=2621
1034 
1035 defines a 2621-nl that does not have the smkx or rmkx capabilities,
1036 and hence does not turn on the function key labels when in visual
1037 mode.  This is useful for different modes for a terminal, or for
1038 different user preferences.
1039 
1040 
1041 Files:
1042 
1043 >sl3p>cc>e>terminfo>?>*    files containing terminal descriptions
1044 
1045 
1046 See also:
1047 
1048 curses.gi.info, term.gi.info, tic.gi.info