TERMINFO(5V) — FILE FORMATS
NAME
terminfo − terminal capability data base
SYNOPSIS
/usr/share/lib/terminfo/?/∗
AVAILABILITY
This database is available with the System V software installation option. Refer to OS/MP Release Notes for information on how to install optional software.
DESCRIPTION
terminfo is a compiled database (see tic(8V)) describing the capabilities of terminals. Terminals are described in terminfo source descriptions by giving a set of capabilities which they have, by describing how operations are performed, by describing padding requirements, and by specifying initialization sequences. This database is used by applications programs, and by libraries such as curses(3V), so they can work with a variety of terminals without changes to the programs. To obtain the source description for a terminal, use the −I option of infocmp(8V).
Entries in terminfo source files consist of a number of comma-separated fields. White space after each comma is ignored. The first line of each terminal description in the terminfo database gives the name by which terminfo knows the terminal, separated by pipe (|) characters. The first name given is the most common abbreviation for the terminal (this is the one to which the environment variable TERM would normally be set), the last name given should be a long name fully identifying the terminal, and all others are understood as synonyms for the terminal name. All names but the last should contain no blanks; the last name may contain blanks for readability.
Terminal names (except for the last, verbose entry) should be chosen using the following conventions:
• The particular piece of hardware making up the terminal should have a root name chosen; for example, for the Hewlett-Packard 2621, hp2621. This name should not contain hyphens.
• Modes that the hardware can be in or user preferences should be indicated by appending a hyphen and an indicator of the mode. Thus, a vt100 in 132-column mode would be given as: vt100−w. The following suffixes should be used where possible:
| Suffix | Meaning | Example |
| −w | wide mode (more than 80 columns) | vt100−w |
| −am | with automatic margins (usually default) | vt100−am |
| −nam | without automatic margins | vt100−nam |
| −n | number of lines on the screen | aaa−60 |
| −na | no arrow keys (leave them in local) | concept100−na |
| −np | number of pages of memory | concept100−4p |
| −rv | reverse video | concept100−rv |
CAPABILITIES
In the table below, the Variable is the name by which the C programmer (at the terminfo level) accesses the capability. The capname is the short name for this variable used in the text of the database. It is used by a person updating the database and by the tput(1V) command when asking what the value of the capability is for a particular terminal. The Termcap Code is a two-letter code that corresponds to the old termcap capability name.
Capability names have no hard length limit, but an informal limit of 5 characters has been adopted to keep them short. Whenever possible, names are chosen to be the same as or similar to the ANSI X3.64-1979 standard. Semantics are also intended to match those of the specification.
All string capabilities listed below may have padding specified, with the exception of those used for input. Input capabilities, listed under the Strings section in the table below, have names beginning with ‘key_’. The following indicators may appear at the end of the Description for a variable.
(G) indicates that the string is passed through tparm() with parameters (parms) as given (#i).
(∗) indicates that padding may be based on the number of lines affected.
(#i) indicates the ith parameter.
| Variable | Capname | Termcap | Description |
| Boolean | |||
| auto_left_margin | bw | bw | cub1 wraps from column 0 to last column |
| auto_right_margin | am | am | Terminal has automatic margins |
| no_esc_ctlc | xsb | xb | Beehive (f1=ESC, f2=^C) |
| ceol_standout_glitch | xhp | xs | Standout not erased by overwriting (Hewlett-Packard) |
| eat_newline_glitch | xenl | xn | NEWLINE ignored after 80 cols (Concept) |
| erase_overstrike | eo | eo | Can erase overstrikes with a blank |
| generic_type | gn | gn | Generic line type (for example, dialup, switch). |
| hard_copy | hc | hc | Hardcopy terminal |
| hard_cursor | chts | HC | Cursor is hard to see |
| has_meta_key | km | km | Has a meta key (shift, sets parity bit) |
| has_status_line | hs | hs | Has extra “status line” |
| insert_null_glitch | in | in | Insert mode distinguishes nulls |
| memory_above | da | da | Display may be retained above the screen |
| memory_below | db | db | Display may be retained below the screen |
| move_insert_mode | mir | mi | Safe to move while in insert mode |
| move_standout_mode | msgr | ms | Safe to move in standout modes |
| needs_xon_xoff | nxon | nx | Padding will not work, xon/xoff required |
| non_rev_rmcup | nrrmc | NR | smcup does not reverse rmcup |
| no_pad_char | npc | NP | Pad character does not exist |
| over_strike | os | os | Terminal overstrikes on hard-copy terminal |
| prtr_silent | mc5i | 5i | Printer will not echo on screen |
| status_line_esc_ok | eslok | es | Escape can be used on the status line |
| dest_tabs_magic_smso | xt | xt | Destructive TAB characters, magic smso char (Teleray 1061) |
| tilde_glitch | hz | hz | Hazeltine; cannot print tildes(~) |
| transparent_underline | ul | ul | Underline character overstrikes |
| xon_xoff | xon | xo | Terminal uses xon/xoff handshaking |
| Number | |||
| columns | cols | co | Number of columns in a line |
| init_tabs | it | it | tab stops initially every # spaces |
| label_height | lh | lh | Number of rows in each label |
| label_width | lw | lw | Number of cols in each label |
| lines | lines | li | Number of lines on screen or page |
| lines_of_memory | lm | lm | Lines of memory if > lines; 0 means varies |
| magic_cookie_glitch | xmc | sg | Number blank chars left by smso or rmso |
| num_labels | nlab | Nl | Number of labels on screen (start at 1) |
| padding_baud_rate | pb | pb | Lowest baud rate where padding needed |
| virtual_terminal | vt | vt | Virtual terminal number (not supported on all systems) |
| width_status_line | wsl | ws | Number of columns in status line |
| String | |||
| acs_chars | acsc | ac | Graphic charset pairs aAbBcC - def=VT100 |
| back_tab | cbt | bt | Back tab |
| bell | bel | bl | Audible signal (bell) |
| carriage_return | cr | cr | RETURN (∗) |
| change_scroll_region | csr | cs | Change to lines #1 through #2 (VT100) (G) |
| char_padding | rmp | rP | Like ip but when in replace mode |
| clear_all_tabs | tbc | ct | Clear all tab stops |
| clear_margins | mgc | MC | Clear left and right soft margins |
| clear_screen | clear | cl | Clear screen and home cursor (∗) |
| clr_bol | el1 | cb | Clear to beginning of line, inclusive |
| clr_eol | el | ce | Clear to end of line |
| clr_eos | ed | cd | Clear to end of display (∗) |
| column_address | hpa | ch | Horizontal position absolute (G) |
| command_character | cmdch | CC | Terminal settable command char in prototype |
| cursor_address | cup | cm | Cursor motion to row #1 col #2 (G) |
| cursor_down | cud1 | do | Down one line |
| cursor_home | home | ho | Home cursor (if no cup) |
| cursor_invisible | civis | vi | Make cursor invisible |
| cursor_left | cub1 | le | Move cursor left one SPACE |
| cursor_mem_address | mrcup | CM | Memory relative cursor addressing (G) |
| cursor_normal | cnorm | ve | Make cursor appear normal (undo cvvis/civis) |
| cursor_right | cuf1 | nd | Non-destructive space (cursor right) |
| cursor_to_ll | ll | ll | Last line, first column (if no cup) |
| cursor_up | cuu1 | up | Upline (cursor up) |
| cursor_visible | cvvis | vs | Make cursor very visible |
| delete_character | dch1 | dc | Delete character (∗) |
| delete_line | dl1 | dl | Delete line (∗) |
| dis_status_line | dsl | ds | Disable status line |
| down_half_line | hd | hd | Half-line down (forward 1/2 LINEFEED) |
| ena_acs | enacs | eA | Enable alternate char set |
| enter_alt_charset_mode | smacs | as | Start alternate character set |
| enter_am_mode | smam | SA | Turn on automatic margins |
| enter_blink_mode | blink | mb | Turn on blinking |
| enter_bold_mode | bold | md | Turn on bold (extra bright) mode |
| enter_ca_mode | smcup | ti | String to begin programs that use cup |
| enter_delete_mode | smdc | dm | Delete mode (enter) |
| enter_dim_mode | dim | mh | Turn on half-bright mode |
| enter_insert_mode | smir | im | Insert mode (enter); |
| enter_protected_mode | prot | mp | Turn on protected mode |
| enter_reverse_mode | rev | mr | Turn on reverse video mode |
| enter_secure_mode | invis | mk | Turn on blank mode (chars invisible) |
| enter_standout_mode | smso | so | Begin standout mode |
| enter_underline_mode | smul | us | Start underscore mode |
| enter_xon_mode | smxon | SX | Turn on xon/xoff handshaking |
| erase_chars | ech | ec | Erase #1 characters (G) |
| exit_alt_charset_mode | rmacs | ae | End alternate character set |
| exit_am_mode | rmam | RA | Turn off automatic margins |
| exit_attribute_mode | sgr0 | me | Turn off all attributes |
| exit_ca_mode | rmcup | te | String to end programs that use cup |
| exit_delete_mode | rmdc | ed | End delete mode |
| exit_insert_mode | rmir | ei | End insert mode; |
| exit_standout_mode | rmso | se | End standout mode |
| exit_underline_mode | rmul | ue | End underscore mode |
| exit_xon_mode | rmxon | RX | Turn off xon/xoff handshaking |
| flash_screen | flash | vb | Visible bell (must not move cursor) |
| form_feed | ff | ff | Hardcopy terminal page eject (∗) |
| from_status_line | fsl | fs | Return from status line |
| init_1string | is1 | i1 | Terminal initialization string |
| init_2string | is2 | is | Terminal initialization string |
| init_3string | is3 | i3 | Terminal initialization string |
| init_file | if | if | Name of initialization file containing is |
| init_prog | iprog | iP | Path name of program for init |
| insert_character | ich1 | ic | Insert character |
| insert_line | il1 | al | Add new blank line (∗) |
| insert_padding | ip | ip | Insert pad after character inserted (∗) |
| key_a1 | ka1 | K1 | KEY_A1, 0534, Upper left of keypad |
| key_a3 | ka3 | K3 | KEY_A3, 0535, Upper right of keypad |
| key_b2 | kb2 | K2 | KEY_B2, 0536, Center of keypad |
| key_backspace | kbs | kb | KEY_BACKSPACE, 0407, Sent by BACKSPACE key |
| key_beg | kbeg | @1 | KEY_BEG, 0542, Sent by beg(inning) key |
| key_btab | kcbt | kB | KEY_BTAB, 0541, Sent by back-tab key |
| key_c1 | kc1 | K4 | KEY_C1, 0537, Lower left of keypad |
| key_c3 | kc3 | K5 | KEY_C3, 0540, Lower right of keypad |
| key_cancel | kcan | @2 | KEY_CANCEL, 0543, Sent by cancel key |
| key_catab | ktbc | ka | KEY_CATAB, 0526, Sent by clear-all-tabs key |
| key_clear | kclr | kC | KEY_CLEAR, 0515, Sent by clear- screen or erase key |
| key_close | kclo | @3 | KEY_CLOSE, 0544, Sent by close key |
| key_command | kcmd | @4 | KEY_COMMAND, 0545, Sent by cmd (command) key |
| key_copy | kcpy | @5 | KEY_COPY, 0546, Sent by copy key |
| key_create | kcrt | @6 | KEY_CREATE, 0547, Sent by create key |
| key_ctab | kctab | kt | KEY_CTAB, 0525, Sent by clear-tab key |
| key_dc | kdch1 | kD | KEY_DC, 0512, Sent by delete-character key |
| key_dl | kdl1 | kL | KEY_DL, 0510, Sent by delete-line key |
| key_down | kcud1 | kd | KEY_DOWN, 0402, Sent by terminal down-arrow key |
| key_eic | krmir | kM | KEY_EIC, 0514, Sent by rmir or smir in insert mode |
| key_end | kend | @7 | KEY_END, 0550, Sent by end key |
| key_enter | kent | @8 | KEY_ENTER, 0527, Sent by enter/send key |
| key_eol | kel | kE | KEY_EOL, 0517, Sent by clear-to-end- of-line key |
| key_eos | ked | kS | KEY_EOS, 0516, Sent by clear-to-end- of-screen key |
| key_exit | kext | @9 | KEY_EXIT, 0551, Sent by exit key |
| key_f0 | kf0 | k0 | KEY_F(0), 0410, Sent by function key f0 |
| key_f1 | kf1 | k1 | KEY_F(1), 0411, Sent by function key f1 |
| key_f2 | kf2 | k2 | KEY_F(2), 0412, Sent by function key f2 |
| key_f3 | kf3 | k3 | KEY_F(3), 0413, Sent by function key f3 |
| key_f4 | kf4 | k4 | KEY_F(4), 0414, Sent by function key f4 |
| key_f5 | kf5 | k5 | KEY_F(5), 0415, Sent by function key f5 |
| key_f6 | kf6 | k6 | KEY_F(6), 0416, Sent by function key f6 |
| key_f7 | kf7 | k7 | KEY_F(7), 0417, Sent by function key f7 |
| key_f8 | kf8 | k8 | KEY_F(8), 0420, Sent by function key f8 |
| key_f9 | kf9 | k9 | KEY_F(9), 0421, Sent by function key f9 |
| key_f10 | kf10 | k; | KEY_F(10), 0422, Sent by function key f10 |
| key_f11 | kf11 | F1 | KEY_F(11), 0423, Sent by function key f11 |
| key_f12 | kf12 | F2 | KEY_F(12), 0424, Sent by function key f12 |
| key_f13 | kf13 | F3 | KEY_F(13), 0425, Sent by function key f13 |
| key_f14 | kf14 | F4 | KEY_F(14), 0426, Sent by function key f14 |
| key_f15 | kf15 | F5 | KEY_F(15), 0427, Sent by function key f15 |
| key_f16 | kf16 | F6 | KEY_F(16), 0430, Sent by function key f16 |
| key_f17 | kf17 | F7 | KEY_F(17), 0431, Sent by function key f17 |
| key_f18 | kf18 | F8 | KEY_F(18), 0432, Sent by function key f18 |
| key_f19 | kf19 | F9 | KEY_F(19), 0433, Sent by function key f19 |
| key_f20 | kf20 | FA | KEY_F(20), 0434, Sent by function key f20 |
| key_f21 | kf21 | FB | KEY_F(21), 0435, Sent by function key f21 |
| key_f22 | kf22 | FC | KEY_F(22), 0436, Sent by function key f22 |
| key_f23 | kf23 | FD | KEY_F(23), 0437, Sent by function key f23 |
| key_f24 | kf24 | FE | KEY_F(24), 0440, Sent by function key f24 |
| key_f25 | kf25 | FF | KEY_F(25), 0441, Sent by function key f25 |
| key_f26 | kf26 | FG | KEY_F(26), 0442, Sent by function key f26 |
| key_f27 | kf27 | FH | KEY_F(27), 0443, Sent by function key f27 |
| key_f28 | kf28 | FI | KEY_F(28), 0444, Sent by function key f28 |
| key_f29 | kf29 | FJ | KEY_F(29), 0445, Sent by function key f29 |
| key_f30 | kf30 | FK | KEY_F(30), 0446, Sent by function key f30 |
| key_f31 | kf31 | FL | KEY_F(31), 0447, Sent by function key f31 |
| key_f32 | kf32 | FM | KEY_F(32), 0450, Sent by function key f32 |
| key_f33 | kf33 | FN | KEY_F(13), 0451, Sent by function key f13 |
| key_f34 | kf34 | FO | KEY_F(34), 0452, Sent by function key f34 |
| key_f35 | kf35 | FP | KEY_F(35), 0453, Sent by function key f35 |
| key_f36 | kf36 | FQ | KEY_F(36), 0454, Sent by function key f36 |
| key_f37 | kf37 | FR | KEY_F(37), 0455, Sent by function key f37 |
| key_f38 | kf38 | FS | KEY_F(38), 0456, Sent by function key f38 |
| key_f39 | kf39 | FT | KEY_F(39), 0457, Sent by function key f39 |
| key_f40 | kf40 | FU | KEY_F(40), 0460, Sent by function key f40 |
| key_f41 | kf41 | FV | KEY_F(41), 0461, Sent by function key f41 |
| key_f42 | kf42 | FW | KEY_F(42), 0462, Sent by function key f42 |
| key_f43 | kf43 | FX | KEY_F(43), 0463, Sent by function key f43 |
| key_f44 | kf44 | FY | KEY_F(44), 0464, Sent by function key f44 |
| key_f45 | kf45 | FZ | KEY_F(45), 0465, Sent by function key f45 |
| key_f46 | kf46 | Fa | KEY_F(46), 0466, Sent by function key f46 |
| key_f47 | kf47 | Fb | KEY_F(47), 0467, Sent by function key f47 |
| key_f48 | kf48 | Fc | KEY_F(48), 0470, Sent by function key f48 |
| key_f49 | kf49 | Fd | KEY_F(49), 0471, Sent by function key f49 |
| key_f50 | kf50 | Fe | KEY_F(50), 0472, Sent by function key f50 |
| key_f51 | kf51 | Ff | KEY_F(51), 0473, Sent by function key f51 |
| key_f52 | kf52 | Fg | KEY_F(52), 0474, Sent by function key f52 |
| key_f53 | kf53 | Fh | KEY_F(53), 0475, Sent by function key f53 |
| key_f54 | kf54 | Fi | KEY_F(54), 0476, Sent by function key f54 |
| key_f55 | kf55 | Fj | KEY_F(55), 0477, Sent by function key f55 |
| key_f56 | kf56 | Fk | KEY_F(56), 0500, Sent by function key f56 |
| key_f57 | kf57 | Fl | KEY_F(57), 0501, Sent by function key f57 |
| key_f58 | kf58 | Fm | KEY_F(58), 0502, Sent by function key f58 |
| key_f59 | kf59 | Fn | KEY_F(59), 0503, Sent by function key f59 |
| key_f60 | kf60 | Fo | KEY_F(60), 0504, Sent by function key f60 |
| key_f61 | kf61 | Fp | KEY_F(61), 0505, Sent by function key f61 |
| key_f62 | kf62 | Fq | KEY_F(62), 0506, Sent by function key f62 |
| key_f63 | kf63 | Fr | KEY_F(63), 0507, Sent by function key f63 |
| key_find | kfnd | @0 | KEY_FIND, 0552, Sent by find key |
| key_help | khlp | %1 | KEY_HELP, 0553, Sent by help key |
| key_home | khome | kh | KEY_HOME, 0406, Sent by home key |
| key_ic | kich1 | kI | KEY_IC, 0513, Sent by ins-char/enter ins-mode key |
| key_il | kil1 | kA | KEY_IL, 0511, Sent by insert-line key |
| key_left | kcub1 | kl | KEY_LEFT, 0404, Sent by terminal left-arrow key |
| key_ll | kll | kH | KEY_LL, 0533, Sent by home-down key |
| key_mark | kmrk | %2 | KEY_MARK, 0554, Sent by mark key |
| key_message | kmsg | %3 | KEY_MESSAGE, 0555, Sent by message key |
| key_move | kmov | %4 | KEY_MOVE, 0556, Sent by move key |
| key_next | knxt | %5 | KEY_NEXT, 0557, Sent by next-object key |
| key_npage | knp | kN | KEY_NPAGE, 0522, Sent by next-page key |
| key_open | kopn | %6 | KEY_OPEN, 0560, Sent by open key |
| key_options | kopt | %7 | KEY_OPTIONS, 0561, Sent by options key |
| key_ppage | kpp | kP | KEY_PPAGE, 0523, Sent by previous-page key |
| key_previous | kprv | %8 | KEY_PREVIOUS, 0562, Sent by previous-object key |
| key_print | kprt | %9 | KEY_PRINT, 0532, Sent by print or copy key |
| key_redo | krdo | %0 | KEY_REDO, 0563, Sent by redo key |
| key_reference | kref | &1 | KEY_REFERENCE, 0564, Sent by ref(erence) key |
| key_refresh | krfr | &2 | KEY_REFRESH, 0565, Sent by refresh key |
| key_replace | krpl | &3 | KEY_REPLACE, 0566, Sent by replace key |
| key_restart | krst | &4 | KEY_RESTART, 0567, Sent by restart key |
| key_resume | kres | &5 | KEY_RESUME, 0570, Sent by resume key |
| key_right | kcuf1 | kr | KEY_RIGHT, 0405, Sent by terminal right-arrow key |
| key_save | ksav | &6 | KEY_SAVE, 0571, Sent by save key |
| key_sbeg | kBEG | &9 | KEY_SBEG, 0572, Sent by shifted beginning key |
| key_scancel | kCAN | &0 | KEY_SCANCEL, 0573, Sent by shifted cancel key |
| key_scommand | kCMD | ∗1 | KEY_SCOMMAND, 0574, Sent by shifted command key |
| key_scopy | kCPY | ∗2 | KEY_SCOPY, 0575, Sent by shifted copy key |
| key_screate | kCRT | ∗3 | KEY_SCREATE, 0576, Sent by shifted create key |
| key_sdc | kDC | ∗4 | KEY_SDC, 0577, Sent by shifted delete-char key |
| key_sdl | kDL | ∗5 | KEY_SDL, 0600, Sent by shifted delete-line key |
| key_select | kslt | ∗6 | KEY_SELECT, 0601, Sent by select key |
| key_send | kEND | ∗7 | KEY_SEND, 0602, Sent by shifted end key |
| key_seol | kEOL | ∗8 | KEY_SEOL, 0603, Sent by shifted clear-line key |
| key_sexit | kEXT | ∗9 | KEY_SEXIT, 0604, Sent by shifted exit key |
| key_sf | kind | kF | KEY_SF, 0520, Sent by scroll-forward/down key |
| key_sfind | kFND | ∗0 | KEY_SFIND, 0605, Sent by shifted find key |
| key_shelp | kHLP | #1 | KEY_SHELP, 0606, Sent by shifted help key |
| key_shome | kHOM | #2 | KEY_SHOME, 0607, Sent by shifted home key |
| key_sic | kIC | #3 | KEY_SIC, 0610, Sent by shifted input key |
| key_sleft | kLFT | #4 | KEY_SLEFT, 0611, Sent by shifted left-arrow key |
| key_smessage | kMSG | %a | KEY_SMESSAGE, 0612, Sent by shifted message key |
| key_smove | kMOV | %b | KEY_SMOVE, 0613, Sent by shifted move key |
| key_snext | kNXT | %c | KEY_SNEXT, 0614, Sent by shifted next key |
| key_soptions | kOPT | %d | KEY_SOPTIONS, 0615, Sent by shifted options key |
| key_sprevious | kPRV | %e | KEY_SPREVIOUS, 0616, Sent by shifted prev key |
| key_sprint | kPRT | %f | KEY_SPRINT, 0617, Sent by shifted print key |
| key_sr | kri | kR | KEY_SR, 0521, Sent by scroll-backward/up key |
| key_sredo | kRDO | %g | KEY_SREDO, 0620, Sent by shifted redo key |
| key_sreplace | kRPL | %h | KEY_SREPLACE, 0621, Sent by shifted replace key |
| key_sright | kRIT | %i | KEY_SRIGHT, 0622, Sent by shifted right-arrow key |
| key_srsume | kRES | %j | KEY_SRSUME, 0623, Sent by shifted resume key |
| key_ssave | kSAV | !1 | KEY_SSAVE, 0624, Sent by shifted save key |
| key_ssuspend | kSPD | !2 | KEY_SSUSPEND, 0625, Sent by shifted suspend key |
| key_stab | khts | kT | KEY_STAB, 0524, Sent by set-tab key |
| key_sundo | kUND | !3 | KEY_SUNDO, 0626, Sent by shifted undo key |
| key_suspend | kspd | &7 | KEY_SUSPEND, 0627, Sent by suspend key |
| key_undo | kund | &8 | KEY_UNDO, 0630, Sent by undo key |
| key_up | kcuu1 | ku | KEY_UP, 0403, Sent by terminal up-arrow key |
| keypad_local | rmkx | ke | Out of “keypad-transmit” mode |
| keypad_xmit | smkx | ks | Put terminal in “keypad-transmit” mode |
| lab_f0 | lf0 | l0 | Labels on function key f0 if not f0 |
| lab_f1 | lf1 | l1 | Labels on function key f1 if not f1 |
| lab_f2 | lf2 | l2 | Labels on function key f2 if not f2 |
| lab_f3 | lf3 | l3 | Labels on function key f3 if not f3 |
| lab_f4 | lf4 | l4 | Labels on function key f4 if not f4 |
| lab_f5 | lf5 | l5 | Labels on function key f5 if not f5 |
| lab_f6 | lf6 | l6 | Labels on function key f6 if not f6 |
| lab_f7 | lf7 | l7 | Labels on function key f7 if not f7 |
| lab_f8 | lf8 | l8 | Labels on function key f8 if not f8 |
| lab_f9 | lf9 | l9 | Labels on function key f9 if not f9 |
| lab_f10 | lf10 | la | Labels on function key f10 if not f10 |
| label_off | rmln | LF | Turn off soft labels |
| label_on | smln | LO | Turn on soft labels |
| meta_off | rmm | mo | Turn off “meta mode” |
| meta_on | smm | mm | Turn on “meta mode” (8th bit) |
| newline | nel | nw | NEWLINE (behaves like cr followed by lf) |
| pad_char | pad | pc | Pad character (rather than null) |
| parm_dch | dch | DC | Delete #1 chars (G∗) |
| parm_delete_line | dl | DL | Delete #1 lines (G∗) |
| parm_down_cursor | cud | DO | Move cursor down #1 lines. (G∗) |
| parm_ich | ich | IC | Insert #1 blank chars (G∗) |
| parm_index | indn | SF | Scroll forward #1 lines. (G) |
| parm_insert_line | il | AL | Add #1 new blank lines (G∗) |
| parm_left_cursor | cub | LE | Move cursor left #1 spaces (G) |
| parm_right_cursor | cuf | RI | Move cursor right #1 spaces. (G∗) |
| parm_rindex | rin | SR | Scroll backward #1 lines. (G) |
| parm_up_cursor | cuu | UP | Move cursor up #1 lines. (G∗) |
| pkey_key | pfkey | pk | Prog funct key #1 to type string #2 |
| pkey_local | pfloc | pl | Prog funct key #1 to execute string #2 |
| pkey_xmit | pfx | px | Prog funct key #1 to xmit string #2 |
| plab_norm | pln | pn | Prog label #1 to show string #2 |
| print_screen | mc0 | ps | Print contents of the screen |
| prtr_non | mc5p | pO | Turn on the printer for #1 bytes |
| prtr_off | mc4 | pf | Turn off the printer |
| prtr_on | mc5 | po | Turn on the printer |
| repeat_char | rep | rp | Repeat char #1 #2 times (G∗) |
| req_for_input | rfi | RF | Send next input char (for ptys) |
| reset_1string | rs1 | r1 | Reset terminal completely to sane modes |
| reset_2string | rs2 | r2 | Reset terminal completely to sane modes |
| reset_3string | rs3 | r3 | Reset terminal completely to sane modes |
| reset_file | rf | rf | Name of file containing reset string |
| restore_cursor | rc | rc | Restore cursor to position of last sc |
| row_address | vpa | cv | Vertical position absolute (G) |
| save_cursor | sc | sc | Save cursor position |
| scroll_forward | ind | sf | Scroll text up |
| scroll_reverse | ri | sr | Scroll text down |
| set_attributes | sgr | sa | Define the video attributes #1-#9 (G) |
| set_left_margin | smgl | ML | Set soft left margin |
| set_right_margin | smgr | MR | Set soft right margin |
| set_tab | hts | st | Set a tab stop in all rows, current column |
| set_window | wind | wi | Current window is lines #1-#2 cols #3-#4 (G) |
| tab | ht | ta | Move the cursor to the next 8 space hardware tab stop |
| to_status_line | tsl | ts | Go to status line, col #1 (G) |
| underline_char | uc | uc | Underscore one char and move past it |
| up_half_line | hu | hu | Half-line up (reverse 1/2 line-feed) |
| xoff_character | xoffc | XF | X-off character |
| xon_character | xonc | XN | X-on character |
SAMPLE ENTRY
The following entry, which describes the Concept 100 terminal, is among the more complex entries in the terminfo file as of this writing.
concept100|c100|concept|c104|c100-4p|concept 100,
am, db, eo, in, mir, ul, xenl, cols#80, lines#24, pb#9600, vt#8,
bel=^G, blank=\EH, blink=\EC, clear=^L$<2∗>, cnorm=\Ew, cr=^M$<9>,
cub1=^H, cud1=^J, cuf1=\E=, cup=\Ea%p1%’ ’%+%c%p2%’ ’%+%c, cuu1=\E;,
cvvis=\EW, dch1=\E^A$<16∗>, dim=\EE, dl1=\E^B$<3∗>,
ed=\E^C$<16∗>, el=\E^U$<16>, flash=\Ek$<20>\EK, ht=\t$<8>,
il1=\E^R$<3∗>, ind=^J, .ind=^J$<9>, ip=$<16∗>,
is2=\EU\Ef\E7\E5\E8\El\ENH\EK\E\0\Eo&\0\Eo\47\E,
kbs=^h, kcub1=\E>, kcud1=\E<, kcuf1=\E=, kcuu1=\E;, kf1=\E5,
kf2=\E6, kf3=\E7, khome=\E?, prot=\EI,
rep=\Er%p1%c%p2%’ ’%+%c$<.2∗>, rev=\ED,
rmcup=\Ev\s\s\s\s$<6>\Ep\r\n, rmir=\E\0, rmkx=\Ex,
rmso=\Ed\Ee, rmul=\Eg, rmul=\Eg, sgr0=\EN\0,
smcup=\EU\Ev\s\s8p\Ep\r, smir=\E^P, smkx=\EX, smso=\EE\ED,
smul=\EG,
Entries may continue onto multiple lines by placing white space at the beginning of each line except the first. Lines beginning with # are taken as comment lines. Capabilities in terminfo are of three types: boolean capabilities which indicate that the terminal has some particular feature, numeric capabilities giving the size of the terminal or particular features, and string capabilities, which give a sequence which can be used to perform particular terminal operations.
Types of Capabilities
All capabilities have names. For instance, the fact that the Concept has automatic margins (that is, an automatic RETURN and LINEFEED when the end of a line is reached) is indicated by the capability am. Hence the description of the Concept includes am. Numeric capabilities are followed by the character # and then the value. Thus cols, which indicates the number of columns the terminal has, gives the value 80 for the Concept. The value may be specified in decimal, octal or hexadecimal using normal C conventions.
Finally, string-valued capabilities, such as el (clear to end of line sequence) are given by the two- to five-character capname, an ‘=’, and then a string ending at the next following comma. A delay in milliseconds may appear anywhere in such a capability, enclosed in $<..> brackets, as in ‘el=\EK$<3>’, and padding characters are supplied by tputs() (see curses(3V)) to provide this delay. The delay can be either a number, for example, 20, or a number followed by an ∗ (for example, 3∗), a / (for example, 5/), or both (for example, 10∗/ ). A ∗ indicates that the padding required is proportional to the number of lines affected by the operation, and the amount given is the per-affected-unit padding required. (In the case of insert character, the factor is still the number of lines affected. This is always one unless the terminal has in and the software uses it.) When a ∗ is specified, it is sometimes useful to give a delay of the form 3.5 to specify a delay per unit to tenths of milliseconds. (Only one decimal place is allowed.) A / indicates that the padding is mandatory. Otherwise, if the terminal has xon defined, the padding information is advisory and will only be used for cost estimates or when the terminal is in raw mode. Mandatory padding will be transmitted regardless of the setting of xon.
A number of escape sequences are provided in the string-valued capabilities for easy encoding of characters there:
\E, \e
map to ESC
^X maps to CTRL-X for any appropriate character X
\n maps to NEWLINE
\l maps to LINEFEED
\r maps to RETURN
\t maps to TAB
\b maps to BACKSPACE
\f maps to FORMFEED
\s maps to SPACE
\0 maps to NUL
(\0 will actually produce \200, which does not terminate a string but behaves as a null character on most terminals.) Finally, characters may be given as three octal digits after a backslash (for example, \123), and the characters ^ (caret), \ (backslash), : (colon), and , (comma) may be given as \^, \\, \:, and \, respectively.
Sometimes individual capabilities must be commented out. To do this, put a period before the capability name. For example, see the second ind in the example above. Note: capabilities are defined in a left-to-right order and, therefore, a prior definition will override a later definition.
Preparing Descriptions
The most effective way to prepare a terminal description is by imitating the description of a similar terminal in terminfo and to build up a description gradually, using partial descriptions with some curses-based application to check that they are correct. Be aware that a very unusual terminal may expose deficiencies in the ability of the terminfo file to describe it or bugs in the application. To test a new terminal description, set the environment variable TERMINFO to a pathname of a directory containing the compiled description you are working on and programs will look there rather than in /usr/share/lib/terminfo. To get the padding for insert-line correct (if the terminal manufacturer did not document it) a severe test is to insert 16 lines into the middle of a full screen at 9600 baud. If the display is corrupted, more padding is usually needed. A similar test can be used for insert-character.
Basic Capabilities
The number of columns on each line for the terminal is given by the cols numeric capability. If the terminal has a screen, then the number of lines on the screen is given by the lines capability. If the terminal wraps around to the beginning of the next line when it reaches the right margin, then it should have the am capability. If the terminal can clear its screen, leaving the cursor in the home position, then this is given by the clear string capability. If the terminal overstrikes (rather than clearing a position when a character is struck over) then it should have the os capability. If the terminal is a printing terminal, with no soft copy unit, give it both hc and os. (os applies to storage scope terminals, such as Tektronix 4010 series, as well as hard-copy and APL terminals.) If there is a code to move the cursor to the left edge of the current row, give this as cr. (Normally this will be RETURN, CTRL-M.) If there is a code to produce an audible signal (bell, beep, etc) give this as bel. If the terminal uses the xon-xoff flow-control protocol, like most terminals, specify xon.
If there is a code to move the cursor one position to the left (such as backspace) that capability should be given as cub1. Similarly, codes to move to the right, up, and down should be given as cuf1, cuu1, and cud1. These local cursor motions should not alter the text they pass over; for example, you would not normally use cuf1=\s because the SPACE would erase the character moved over.
A very important point here is that the local cursor motions encoded in terminfo are undefined at the left and top edges of a screen terminal. Programs should never attempt to backspace around the left edge, unless bw is given, and should never attempt to go up locally off the top. In order to scroll text up, a program will go to the bottom left corner of the screen and send the ind (index) string.
To scroll text down, a program goes to the top left corner of the screen and sends the ri (reverse index) string. The strings ind and ri are undefined when not on their respective corners of the screen.
Parameterized versions of the scrolling sequences are indn and rin which have the same semantics as ind and ri except that they take one parameter, and scroll that many lines. They are also undefined except at the appropriate edge of the screen.
The am capability tells whether the cursor sticks at the right edge of the screen when text is output, but this does not necessarily apply to a cuf1 from the last column. The only local motion which is defined from the left edge is if bw is given, then a cub1 from the left edge will move to the right edge of the previous row. If bw is not given, the effect is undefined. This is useful for drawing a box around the edge of the screen, for example. If the terminal has switch selectable automatic margins, the terminfo file usually assumes that this is on; that is, am. If the terminal has a command which moves to the first column of the next line, that command can be given as nel (NEWLINE). It does not matter if the command clears the remainder of the current line, so if the terminal has no cr and lf it may still be possible to craft a working nel out of one or both of them.
These capabilities suffice to describe hardcopy and screen terminals. Thus the model 33 teletype is described as
33|tty33|tty|model 33 teletype,
bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,
while the Lear Siegler ADM−3 is described as
adm3|lsi adm3,
am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H,
cud1=^J, ind=^J, lines#24,
Parameterized Strings
Cursor addressing and other strings requiring parameters in the terminal are described by a parameterized string capability, with printf(3V)-like escapes (%x) in it. For example, to address the cursor, the cup capability is given, using two parameters: the row and column to address to. (Rows and columns are numbered from zero and refer to the physical screen visible to the user, not to any unseen memory.) If the terminal has memory relative cursor addressing, that can be indicated by mrcup.
The parameter mechanism uses a stack and special % codes to manipulate it in the manner of a Reverse Polish Notation (postfix) calculator. Typically a sequence will push one of the parameters onto the stack and then print it in some format. Often more complex operations are necessary. Binary operations are in postfix form with the operands in the usual order. That is, to get x−5 one would use ‘%gx%{5}%−’.
The % encodings have the following meanings:
%% outputs %
%[[:]flags][width[.precision]][doxXs]
as in printf(3V), flags are [−+#] and SPACE
%c print pop() gives %c
%p[1-9] push ith parm
%P[a-z] set variable [a-z] to pop()
%g[a-z] get variable [a-z] and push it
%’c’ push char constant c
%{nn} push decimal constant nn
%l push strlen(pop())
%+ %− %∗ %/ %m
arithmetic (%m is mod): push(pop() op pop())
%& %| %^ bit operations: push(pop() op pop())
%= %> %<
logical operations: push(pop() op pop())
%A %O logical operations: and, or
%! %~ unary operations: push(op pop())
%i (for ANSI terminals)
add 1 to first parm, if one parm present,
or first two parms, if more than one
parm present
%?expr%tthenpart%eelsepart%;
if-then-else, ‘%eelsepart’ is optional; else-if’s are possible in Algol 68:
%? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e b5%;
ci are conditions, bi are bodies.
If the ‘−’ flag is used with ‘%[doxXs]’, then a colon (:) must be placed between the ‘%’ and the ‘−’ to differentiate the flag from the binary ‘%−’ operator, for example, ‘%:−16.16s’.
Consider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needs to be sent \E&a12c03Y padded for 6 milliseconds. Note: the order of the rows and columns is inverted here, and that the row and column are zero-padded as two digits. Thus its cup capability is:
cup=\E&a%p2%2.2dc%p1%2.2dY$<6>
The Micro-Term ACT-IV needs the current row and column sent preceded by a ^T, with the row and column simply encoded in binary, ‘cup=^T%p1%c%p2%c’. Terminals which use %c need to be able to backspace the cursor (cub1), and to move the cursor up one line on the screen (cuu1). This is necessary because it is not always safe to transmit \n, ^D, and \r, as the system may change or discard them. (The library routines dealing with terminfo set tty modes so that TAB characters are never expanded, so \t is safe to send. This turns out to be essential for the Ann Arbor 4080.)
A final example is the LSI ADM-3a, which uses row and column offset by a blank character, thus ‘cup=\E=%p1%’\s’%+%c%p2%’\s’%+%c’. After sending ‘\E=’, this pushes the first parameter, pushes the ASCII value for a space (32), adds them (pushing the sum on the stack in place of the two previous values), and outputs that value as a character. Then the same is done for the second parameter. More complex arithmetic is possible using the stack.
Cursor Motions
If the terminal has a fast way to home the cursor (to very upper left corner of screen) then this can be given as home; similarly a fast way of getting to the lower left-hand corner can be given as ll; this may involve going up with cuu1 from the home position, but a program should never do this itself (unless ll does) because it can make no assumption about the effect of moving up from the home position. Note: the home position is the same as addressing to (0,0): to the top left corner of the screen, not of memory. (Thus, the \EH sequence on Hewlett-Packard terminals cannot be used for home without losing some of the other features on the terminal.)
If the terminal has row or column absolute-cursor addressing, these can be given as single parameter capabilities hpa (horizontal position absolute) and vpa (vertical position absolute). Sometimes these are shorter than the more general two-parameter sequence (as with the Hewlett-Packard 2645) and can be used in preference to cup. If there are parameterized local motions (for example, move n spaces to the right) these can be given as cud, cub, cuf, and cuu with a single parameter indicating how many spaces to move. These are primarily useful if the terminal does not have cup, such as the Tektronix 4025.
Area Clears
If the terminal can clear from the current position to the end of the line, leaving the cursor where it is, this should be given as el. If the terminal can clear from the beginning of the line to the current position inclusive, leaving the cursor where it is, this should be given as el1. If the terminal can clear from the current position to the end of the display, then this should be given as ed. ed is only defined from the first column of a line. (Thus, it can be simulated by a request to delete a large number of lines, if a true ed is not available.)
Insert/Delete Line
If the terminal can open a new blank line before the line where the cursor is, this should be given as ‘il1’; this is done only from the first position of a line. The cursor must then appear on the newly blank line. If the terminal can delete the line which the cursor is on, then this should be given as ‘dl1’; this is done only from the first position on the line to be deleted. Versions of il1 and dl1 which take a single parameter and insert or delete that many lines can be given as il and dl.
If the terminal has a settable destructive scrolling region (like the VT100) the command to set this can be described with the csr capability, which takes two parameters: the top and bottom lines of the scrolling region. The cursor position is, alas, undefined after using this command. It is possible to get the effect of insert or delete line using this command — the sc and rc (save and restore cursor) commands are also useful. Inserting lines at the top or bottom of the screen can also be done using ri or ind on many terminals without a true insert/delete line, and is often faster even on terminals with those features.
To determine whether a terminal has destructive scrolling regions or non-destructive scrolling regions, create a scrolling region in the middle of the screen, place data on the bottom line of the scrolling region, move the cursor to the top line of the scrolling region, and do a reverse index (ri) followed by a delete line (dl1) or index (ind). If the data that was originally on the bottom line of the scrolling region was restored into the scrolling region by the dl1 or ind, then the terminal has non-destructive scrolling regions. Otherwise, it has destructive scrolling regions. Do not specify csr if the terminal has non-destructive scrolling regions, unless ind, ri, indn, rin, dl, and dl1 all simulate destructive scrolling.
If the terminal has the ability to define a window as part of memory, which all commands affect, it should be given as the parameterized string wind. The four parameters are the starting and ending lines in memory and the starting and ending columns in memory, in that order.
If the terminal can retain display memory above, then the da capability should be given; if display memory can be retained below, then db should be given. These indicate that deleting a line or scrolling a full screen may bring non-blank lines up from below or that scrolling back with ri may bring down non-blank lines.
Insert/Delete Character
There are two basic kinds of intelligent terminals with respect to insert/delete character operations which can be described using terminfo. The most common insert/delete character operations affect only the characters on the current line and shift characters off the end of the line rigidly. Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make a distinction between typed and untyped blanks on the screen, shifting upon an insert or delete only to an untyped blank on the screen which is either eliminated, or expanded to two untyped blanks. You can determine the kind of terminal you have by clearing the screen and then typing text separated by cursor motions. Type ‘abc def’ using local cursor motions (not SPACE characters) between the abc and the def. Then position the cursor before the abc and put the terminal in insert mode. If typing characters causes the rest of the line to shift rigidly and characters to fall off the end, then your terminal does not distinguish between blanks and untyped positions. If the abc shifts over to the def which then move together around the end of the current line and onto the next as you insert, you have the second type of terminal, and should give the capability in, which stands for “insert null”. While these are two logically separate attributes (one line versus multiline insert mode, and special treatment of untyped blanks) we have seen no terminals whose insert mode cannot be described with the single attribute.
terminfo can describe both terminals which have an insert mode and terminals which send a simple sequence to open a blank position on the current line. Give as smir the sequence to get into insert mode. Give as rmir the sequence to leave insert mode. Now give as ich1 any sequence needed to be sent just before sending the character to be inserted. Most terminals with a true insert mode will not give ich1; terminals which send a sequence to open a screen position should give it here. (If your terminal has both, insert mode is usually preferable to ich1. Do not give both unless the terminal actually requires both to be used in combination.) If post-insert padding is needed, give this as a number of milliseconds padding in ip (a string option). Any other sequence which may need to be sent after an insert of a single character may also be given in ip. If your terminal needs both to be placed into an “insert mode” and a special code to precede each inserted character, then both smir/rmir and ich1 can be given, and both will be used. The ich capability, with one parameter, n, will repeat the effects of ich1 n times.
If padding is necessary between characters typed while not in insert mode, give this as a number of milliseconds padding in rmp.
It is occasionally necessary to move around while in insert mode to delete characters on the same line (for example, if there is a TAB character after the insertion position). If your terminal allows motion while in insert mode you can give the capability mir to speed up inserting in this case. Omitting mir will affect only speed. Some terminals (notably Datamedia’s) must not have mir because of the way their insert mode works.
Finally, you can specify dch1 to delete a single character, dch with one parameter, n, to delete n characters, and delete mode by giving smdc and rmdc to enter and exit delete mode (any mode the terminal needs to be placed in for dch1 to work).
A command to erase n characters (equivalent to outputting n blanks without moving the cursor) can be given as ech with one parameter.
Highlighting, Underlining, and Visible Bells
If your terminal has one or more kinds of display attributes, these can be represented in a number of different ways. You should choose one display form as standout mode (see curses(3V)), representing a good, high contrast, easy-on-the-eyes, format for highlighting error messages and other attention getters. (If you have a choice, reverse-video plus half-bright is good, or reverse-video alone; however, different users have different preferences on different terminals.) The sequences to enter and exit standout mode are given as smso and rmso, respectively. If the code to change into or out of standout mode leaves one or even two blanks on the screen, as the TVI 912 and Teleray 1061 do, then xmc should be given to tell how many blanks are left.
Codes to begin underlining and end underlining can be given as smul and rmul respectively. If the terminal has a code to underline the current character and move the cursor one position to the right, such as the Micro-Term MIME, this can be given as uc.
Other capabilities to enter various highlighting modes include blink (blinking), bold (bold or extra-bright), dim (dim or half-bright), invis (blanking or invisible text), prot (protected), rev (reverse-video), sgr0 (turn off all attribute modes), smacs (enter alternate-character-set mode), and rmacs (exit alternate-character-set mode). Turning on any of these modes singly may or may not turn off other modes. If a command is necessary before alternate character set mode is entered, give the sequence in enacs (enable alternate-character-set mode).
If there is a sequence to set arbitrary combinations of modes, this should be given as sgr (set attributes), taking nine parameters. Each parameter is either 0 or non-zero, as the corresponding attribute is on or off. The nine parameters are, in order: standout, underline, reverse, blink, dim, bold, blank, protect, alternate character set. Not all modes need be supported by sgr, only those for which corresponding separate attribute commands exist. (See the example at the end of this section.)
Terminals with the “magic cookie” glitch (xmc) deposit special “cookies” when they receive mode-setting sequences, which affect the display algorithm rather than having extra bits for each character. Some terminals, such as the Hewlett-Packard 2621, automatically leave standout mode when they move to a new line or the cursor is addressed. Programs using standout mode should exit standout mode before moving the cursor or sending a newline, unless the msgr capability, asserting that it is safe to move in standout mode, is present.
If the terminal has a way of flashing the screen to indicate an error quietly (a bell replacement), then this can be given as flash; it must not move the cursor. A good flash can be done by changing the screen into reverse video, pad for 200 ms, then return the screen to normal video.
If the cursor needs to be made more visible than normal when it is not on the bottom line (to make, for example, a non-blinking underline into an easier to find block or blinking underline) give this sequence as cvvis. The boolean chts should also be given. If there is a way to make the cursor completely invisible, give that as civis. The capability cnorm should be given which undoes the effects of either of these modes.
If the terminal needs to be in a special mode when running a program that uses these capabilities, the codes to enter and exit this mode can be given as smcup and rmcup. This arises, for example, from terminals like the Concept with more than one page of memory. If the terminal has only memory relative cursor addressing and not screen relative cursor addressing, a one screen-sized window must be fixed into the terminal for cursor addressing to work properly. This is also used for the Tektronix 4025, where smcup sets the command character to be the one used by terminfo. If the smcup sequence will not restore the screen after an rmcup sequence is output (to the state prior to outputting rmcup), specify nrrmc.
If your terminal generates underlined characters by using the underline character (with no special codes needed) even though it does not otherwise overstrike characters, then you should give the capability ul. For terminals where a character overstriking another leaves both characters on the screen, give the capability os. If overstrikes are erasable with a blank, then this should be indicated by giving eo.
Example of highlighting: assume that the terminal under question needs the following escape sequences to turn on various modes.
| tparm | attribute | escape sequence |
| parameter | ||
| none | \E[0m | |
| p1 | standout | \E[0;4;7m |
| p2 | underline | \E[0;3m |
| p3 | reverse | \E[0;4m |
| p4 | blink | \E[0;5m |
| p5 | dim | \E[0;7m |
| p6 | bold | \E[0;3;4m |
| p7 | invis | \E[0;8m |
| p8 | protect | not available |
| p9 | altcharset | ^O (off) ^N(on) |
Note: each escape sequence requires a 0 to turn off other modes before turning on its own mode. Also note that, as suggested above, standout is set up to be the combination of reverse and dim. Also, since this terminal has no bold mode, bold is set up as the combination of reverse and underline. In addition, to allow combinations, such as underline+blink, the sequence to use would be ‘\E[0;3;5m’. The terminal does not have protect mode, either, but that cannot be simulated in any way, so p8 is ignored. The altcharset mode is different in that it is either ^O or ^N depending on whether it is off or on. If all modes were to be turned on, the sequence would be ‘\E[0;3;4;5;7;8m^N’.
Now look at when different sequences are output. For example, ‘;3’ is output when either ‘p2’ or ‘p6’ is true, that is, if either underline or bold modes are turned on. Writing out the above sequences, along with their dependencies, gives the following:
| sequence | when to output | terminfo translation |
| \E[0 | always | \E[0 |
| ;3 | if p2 or p6 | %?%p2%p6%|%t;3%; |
| ;4 | if p1 or p3 or p6 | %?%p1%p3%|%p6%|%t;4%; |
| ;5 | if p4 | %?%p4%t;5%; |
| ;7 | if p1 or p5 | %?%p1%p5%|%t;7%; |
| ;8 | if p7 | %?%p7%t;8%; |
| m | always | m |
| ^N or ^O | if p9 ^N, else ^O | %?%p9%t^N%e^O%; |
Putting this all together into the sgr sequence gives:
sgr=\E[0%?%p2%p6%|%t;3%;%?%p1%p3%|%p6%|%t;4%;%?%p5%t;5%;%?%p1%p5%
|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;,
Keypad
If the terminal has a keypad that transmits codes when the keys are pressed, this information can be given. Note: it is not possible to handle terminals where the keypad only works in local (this applies, for example, to the unshifted Hewlett-Packard 2621 keys). If the keypad can be set to transmit or not transmit, give these codes as smkx and rmkx. Otherwise the keypad is assumed to always transmit.
The codes sent by the left arrow, right arrow, up arrow, down arrow, and home keys can be given as kcub1, kcuf1, kcuu1, kcud1, and khome respectively. If there are function keys such as f0, f1, ..., f63, the codes they send can be given as kf0, kf1, ..., kf63. If the first 11 keys have labels other than the default f0 through f10, the labels can be given as lf0, lf1, ..., lf10. The codes transmitted by certain other special keys can be given: kll (home down), kbs (BACKSPACE), ktbc (clear all tab stops), kctab (clear the tab stop in this column), kclr (clear screen or erase key), kdch1 (delete character), kdl1 (delete line), krmir (exit insert mode), kel (clear to end of line), ked (clear to end of screen), kich1 (insert character or enter insert mode), kil1 (insert line), knp (next page), kpp (previous page), kind (scroll forward/down), kri (scroll backward/up), khts (set a tab stop in this column). In addition, if the keypad has a 3 by 3 array of keys including the four arrow keys, the other five keys can be given as ka1, ka3, kb2, kc1, and kc3. These keys are useful when the effects of a 3 by 3 directional pad are needed. Further keys are defined above in the capabilities list.
Strings to program function keys can be given as pfkey, pfloc, and pfx. A string to program their soft-screen labels can be given as pln. Each of these strings takes two parameters: the function key number to program (from 0 to 10) and the string to program it with. Function key numbers out of this range may program undefined keys in a terminal-dependent manner. The difference between the capabilities is that pfkey causes pressing the given key to be the same as the user typing the given string; pfloc executes the string by the terminal in local mode; and pfx transmits the string to the computer. The capabilities nlab, lw and lh define how many soft labels there are and their width and height. If there are commands to turn the labels on and off, give them in smln and rmln. smln is normally output after one or more pln sequences to make sure that the change becomes visible.
Tabs and Initialization
If the terminal has hardware tab stops, the command to advance to the next tab stop can be given as ht (usually CTRL-I). A “backtab” command which moves leftward to the next tab stop can be given as cbt. By convention, if the teletype modes indicate that TAB characters are being expanded by the computer rather than being sent to the terminal, programs should not use ht or cbt even if they are present, since the user may not have the tab stops properly set. If the terminal has hardware tab stops which are initially set every n spaces when the terminal is powered up, the numeric parameter it is given, showing the number of spaces the tab stops are set to. This is normally used by ‘tput init’ (see tput(1V)) to determine whether to set the mode for hardware TAB expansion and whether to set the tab stops. If the terminal has tab stops that can be saved in nonvolatile memory, the terminfo description can assume that they are properly set. If there are commands to set and clear tab stops, they can be given as tbc (clear all tab stops) and hts (set a tab stop in the current column of every row).
Other capabilities include: is1, is2, and is3, initialization strings for the terminal; iprog, the path name of a program to be run to initialize the terminal; and if, the name of a file containing long initialization strings. These strings are expected to set the terminal into modes consistent with the rest of the terminfo description. They must be sent to the terminal each time the user logs in and be output in the following order: run the program iprog; output is1; output is2; set the margins using mgc, smgl and smgr; set the tab stops using tbc and hts; print the file if; and finally output is3. This is usually done using the init option of tput(1V).
Most initialization is done with is2. Special terminal modes can be set up without duplicating strings by putting the common sequences in is2 and special cases in is1 and is3. Sequences that do a harder reset from a totally unknown state can be given as rs1, rs2, rf, and rs3, analogous to is1, is2, is3, and if. (The method using files, if and rf, is used for a few terminals, from /usr/share/lib/tabset/∗; however, the recommended method is to use the initialization and reset strings.) These strings are output by ‘tput reset’, which is used when the terminal gets into a wedged state. Commands are normally placed in rs1, rs2, rs3, and rf only if they produce annoying effects on the screen and are not necessary when logging in. For example, the command to set a terminal into 80-column mode would normally be part of is2, but on some terminals it causes an annoying glitch on the screen and is not normally needed since the terminal is usually already in 80-column mode.
If a more complex sequence is needed to set the tab stops than can be described by using tbc and hts, the sequence can be placed in is2 or if.
If there are commands to set and clear margins, they can be given as mgc (clear all margins), smgl (set left margin), and smgr (set right margin).
Delays
Certain capabilities control padding in the terminal driver. These are primarily needed by hard-copy terminals, and are used by ‘tput init’ to set tty modes appropriately. Delays embedded in the capabilities cr, ind, cub1, ff, and tab can be used to set the appropriate delay bits to be set in the tty driver. If pb (padding baud rate) is given, these values can be ignored at baud rates below the value of pb.
Status Lines
If the terminal has an extra “status line” that is not normally used by software, this fact can be indicated. If the status line is viewed as an extra line below the bottom line, into which one can cursor address normally (such as the Heathkit H19’s 25th line, or the 24th line of a VT100 which is set to a 23-line scrolling region), the capability hs should be given. Special strings that go to a given column of the status line and return from the status line can be given as tsl and fsl. (fsl must leave the cursor position in the same place it was before tsl. If necessary, the sc and rc strings can be included in tsl and fsl to get this effect.) The capability tsl takes one parameter, which is the column number of the status line the cursor is to be moved to.
If escape sequences and other special commands, such as TAB, work while in the status line, the flag eslok can be given. A string which turns off the status line (or otherwise erases its contents) should be given as dsl. If the terminal has commands to save and restore the position of the cursor, give them as sc and rc. The status line is normally assumed to be the same width as the rest of the screen, for example, cols. If the status line is a different width (possibly because the terminal does not allow an entire line to be loaded) the width, in columns, can be indicated with the numeric parameter wsl.
Line Graphics
If the terminal has a line drawing alternate character set, the mapping of glyph to character would be given in acsc. The definition of this string is based on the alternate character set used in the DEC VT100 terminal, extended slightly with some characters from the AT&T 4410v1 terminal.
| glyph name | VT100+ |
| character | |
| arrow pointing right | + |
| arrow pointing left | , |
| arrow pointing down | . |
| solid square block | 0 |
| lantern symbol | I |
| arrow pointing up | − |
| diamond | ‘ |
| checker board (stipple) | a |
| degree symbol | f |
| plus/minus | g |
| board of squares | h |
| lower right corner | j |
| upper right corner | k |
| upper left corner | l |
| lower left corner | m |
| plus | n |
| scan line 1 | o |
| horizontal line | q |
| scan line 9 | s |
| left tee (⏐-) | t |
| right tee (−⏐) | u |
| bottom tee (_ ⏐) |
v |
| top tee (‾ ⏐) |
w |
| vertical line | x |
| bullet | ~ |
The best way to describe a new terminal’s line graphics set is to add a third column to the above table with the characters for the new terminal that produce the appropriate glyph when the terminal is in the alternate character set mode. For example,
| glyph name | VT100+ | new tty |
| char | char | |
| upper left corner | l | R |
| lower left corner | m | F |
| upper right corner | k | T |
| lower right corner | j | G |
| horizontal line | q | , |
| vertical line | x | . |
Now write down the characters left to right, as in ‘acsc=lRmFkTjGq\,x.’.
Miscellaneous
If the terminal requires other than a null (zero) character as a pad, then this can be given as pad. Only the first character of the pad string is used. If the terminal does not have a pad character, specify npc.
If the terminal can move up or down half a line, this can be indicated with hu (half-line up) and hd (half-line down). This is primarily useful for superscripts and subscripts on hardcopy terminals. If a hardcopy terminal can eject to the next page (form feed), give this as ff (usually CTRL-L).
If there is a command to repeat a given character a given number of times (to save time transmitting a large number of identical characters) this can be indicated with the parameterized string rep. The first parameter is the character to be repeated and the second is the number of times to repeat it. Thus, ‘tparm(repeat_char, ’x’, 10)’ is the same as ‘xxxxxxxxxx’.
If the terminal has a settable command character, such as the Tektronix 4025, this can be indicated with cmdch. A prototype command character is chosen which is used in all capabilities. This character is given in the cmdch capability to identify it. On some UNIX systems, when the environment variable CC is set to a single-character value, all occurrences of the prototype character are replaced with that character.
Terminal descriptions that do not represent a specific kind of known terminal, such as switch, dialup, patch, and network, should include the gn (generic) capability so that programs can complain that they do not know how to talk to the terminal. (This capability does not apply to virtual terminal descriptions for which the escape sequences are known.) If the terminal is one of those supported by the UNIX system virtual terminal protocol, the terminal number can be given as vt. A line-turn-around sequence to be transmitted before doing reads should be specified in rfi.
If the terminal uses xon/xoff handshaking for flow control, give xon. Padding information should still be included so that routines can make better decisions about costs, but actual pad characters will not be transmitted. Sequences to turn on and off xon/xoff handshaking may be given in smxon and rmxon. If the characters used for handshaking are not ^S and ^Q (CTRL-S and CTRL-Q, respectively), they may be specified with xonc and xoffc.
If the terminal has a “meta key” which acts as a shift key, setting the 8th bit of any character transmitted, this fact can be indicated with km. Otherwise, software will assume that the 8th bit is parity and it will usually be cleared. If strings exist to turn this “meta mode” on and off, they can be given as smm and rmm.
If the terminal has more lines of memory than will fit on the screen at once, the number of lines of memory can be indicated with lm. A value of lm#0 indicates that the number of lines is not fixed, but that there is still more memory than fits on the screen.
Media copy strings which control an auxiliary printer connected to the terminal can be given as mc0: print the contents of the screen, mc4: turn off the printer, and mc5: turn on the printer. When the printer is on, all text sent to the terminal will be sent to the printer. A variation, mc5p, takes one parameter, and leaves the printer on for as many characters as the value of the parameter, then turns the printer off. The parameter should not exceed 255. If the text is not displayed on the terminal screen when the printer is on, specify mc5i (silent printer). All text, including mc4, is transparently passed to the printer while an mc5p is in effect.
Special Cases
The working model used by terminfo fits most terminals reasonably well. However, some terminals do not completely match that model, requiring special support by terminfo. These are not meant to be construed as deficiencies in the terminals; they are just differences between the working model and the actual hardware. They may be unusual devices or, for some reason, do not have all the features of the terminfo model implemented.
Terminals which can not display tilde (~) characters, such as certain Hazeltine terminals, should indicate hz.
Terminals which ignore a LINEFEED immediately after an am wrap, such as the Concept 100, should indicate xenl. Those terminals whose cursor remains on the right-most column until another character has been received, rather than wrapping immediately upon receiving the right-most character, such as the VT100, should also indicate xenl.
If el is required to get rid of standout (instead of writing normal text on top of it), xhp should be given.
Those Teleray terminals whose tabs turn all characters moved over to blanks, should indicate xt (destructive TAB characters). This capability is also taken to mean that it is not possible to position the cursor on top of a “magic cookie” therefore, to erase standout mode, it is instead necessary to use delete and insert line.
Those Beehive Superbee terminals which do not transmit the escape or CTRL-C characters, should specify xsb, indicating that the f1 key is to be used for escape and the f2 key for CTRL-C.
Similar Terminals
If there are two very similar terminals, one can be defined as being just like the other with certain exceptions. The string capability use can be given with the name of the similar terminal. The capabilities given before use override those in the terminal type invoked by use. A capability can be canceled by placing xx@ to the left of the capability definition, where xx is the capability. For example, the entry
att4424-2|Teletype 4424 in display function group ii,
rev@, sgr@, smul@, use=att4424,
defines an AT&T 4424 terminal that does not have the rev, sgr, and smul capabilities, and hence cannot do highlighting. This is useful for different modes for a terminal, or for different user preferences. More than one use capability may be given.
FILES
/usr/share/lib/terminfo/?/∗
compiled terminal description database
/usr/share/lib/tabset/∗
tab stop settings for some terminals, in a format appropriate to be output to the terminal (escape sequences that set margins and tab stops)
SEE ALSO
tput(1V), curses(3V), printf(3V), term(5V), captoinfo(8V), infocmp(8V), tic(8V)
WARNING
As described in the Tabs and Initialization section above, a terminal’s initialization strings, is1, is2, and is3, if defined, must be output before a curses(3V) program is run. An available mechanism for outputting such strings is tput init (see tput(1V)).
Tampering with entries in /usr/share/lib/terminfo/?/∗ (for example, changing or removing an entry) can affect programs that expect the entry to be present and correct. In particular, removing the description for the “dumb” terminal will cause unexpected problems.
Solbourne Computer, Inc. — 26 February 1988