[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4 Files Reference

terminfo Directory

Purpose

Contains compiled terminfo source files.

Description

Terminfo is a compiled database describing the capabilities of terminals. Terminals are described in the terminfo source files via entries. Each entry contains information about the capabilities for a particular terminal or set of common terminals. Capabilities include the operations that can be performed, the padding requirements, cursor positioning, command sequences, and initialization sequences.

The compiled terminfo database is used by applications such as curses and vi that must have knowledge of the terminal but do not want to be terminal-dependent.

This article describes the terminfo source file format and covers the following topics:

An example of a terminfo source file is provided.

This article explains the terminfo source file format. Before a terminfo description can be used by applications, the terminfo source file it resides in must be compiled using the tic command. Using the tic command results in the creation of one or more binaries, one for each terminal. The collection of terminfo binaries in a directory (usually /usr/share/lib/terminfo) is known as the terminfo database, or terminfo.

Source File Entries

You can edit or modify source files. A source file can contain one or more terminal descriptions or entries. A terminfo source file has a .ti suffix. Examples of source files are the /usr/share/lib/terminfo/ibm.ti file, which describes IBM terminals, and the /usr/share/lib/terminfo/dec.ti file, which describes DEC terminals.

See the infocmp command for obtaining the source description for a terminal when only the binary is available.

Each entry in a terminfo source file consists of a number of fields separated by commas. White space between commas is ignored. The following example shows a source file entry:

ibm6155-113|IBM 6155 Black & White display,
        font0=\E[10m,   font1=\E[11m,   font2=\E[12m,
        bold=\E[12m,    sgr0=\E[0;10m,
        cols#113,       lines#38,
        sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m,
        blink@,         use=ibm5151,

Entries can continue onto multiple lines by placing white space at the beginning of each subsequent line. To create a comment line, begin the line with a # (pound sign) character. To comment out an individual terminal capability, put a period before the capability name.

The first field (or line) for each terminal gives the various names by which the terminal is known, separated by | (pipe symbol) characters. The first name given should be the most common abbreviation for the terminal. (This name is the one most commonly used when setting the TERM environment variable.) The last name given should be a long name fully identifying the terminal. All other names 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. All names should be unique.

The remaining fields identify the terminal 's capabilities.

When choosing terminal names, there are some conventions you should follow. The root name should represent the particular hardware class of the terminal. Do not use hyphens in the root name, except to avoid synonyms that conflict with other names. To indicate possible modes for the hardware or user preferences, append a - (minus sign) and one of the following suffixes:

Root Name Suffixes
Suffix Meaning Example
-am With automatic margins (usually default) Terminal-am
-m Monochrome mode Terminal-m
-w Wide mode (more than 80 columns) Terminal-w
-nam Without automatic margins Terminal-nam
-n Number of lines on the screen Terminal-60
-na No arrow keys (leave them in local) Terminal-na
-np Number of pages of memory Terminal-4p
-rv Reverse video Terminal-rv
-s Status line simulation. The terminal allows for one or more lines that are normally part of the screen to be used for the status line. This is not the same as terminals that have permanently dedicated status lines. Terminal-s
-unk Unknown mode. This entry can be used to define a general description of a terminal that has several of the modes described above. The other entries would use the unknown entry as a base description and add the appropriate customization. See the use= field. Terminal-unk

A terminal in 132-column mode would be Terminal-w.

Types of Capabilities

A terminfo entry can define any number of capabilities. All capabilities belong to one of three types:

Boolean Indicates that the terminal has a particular feature. Boolean capabilities are true if the corresponding name is contained in the terminal description.
Numeric Gives the size of the terminal or the size of particular delays.
String Gives a sequence that can be used to perform particular terminal operations.

This article provides tables that document the capability types. All the tables list the following:

Variable The name the application uses to access a capability.
Cap Name The short capability name. This name is used in the terminfo database text and by the person creating or editing a source file entry. You can use the tput command to output the value of a capability for a particular terminal.
I.Code The 2-letter internal code used in the compiled database. This code always corresponds to a termcap capability name.
Description A description of the capability.

Capability names have no absolute length limit. An informal limit of five characters is adopted to keep them short and to allow the tabs in the caps source file to be aligned. Whenever possible, names are chosen to be the same as or similar to the ANSI X3.64 standard of 1979.

For a detailed description of the various capabilities according to function, read:

Boolean Capabilities

A Boolean capability indicates that the terminal has some particular feature. For instance, the am capability in a terminal description indicates that the terminal has automatic margins (such as an automatic new line when the end of a line is reached). The following are the Boolean capabilities:

Boolean Capabilities
Variable Cap Name I.Code Description
auto_left_margin bw bw Indicates cub1 wraps from column 0 to last column.
auto_right_margin am am Indicates terminal has automatic margins.
back_color_erase bce ut Erases screen with current background.
can_change ccc cc Can redefine existing color.
ceol_standout_glitch xhp xs Indicates that standout is not erased by overwriting.
col_addr_glitch xhpa YA Indicates only positive motion for hpa/mhpa caps.
cpi_changes_res cpix YF Indicates resolution changed when changing character pitch.
cr_cancels_micro_mode crxm YB Indicates cr turns off micro mode.
dest_tabs_magic_smso (or teleray_glitch) xt xt Indicates destructive tabs and blanks inserted while entering standout mode.
eat_newline_glitch xenl xn Ignores new-line character after 80 columns.
erase_overstrike eo eo Erases overstrikes with a blank.
generic_type gn gn Indicates generic line type, such as, dialup or switch.
hard_copy hc hc Indicates hardcopy terminal.
hard_cursor chts HC Indicates cursor is hard to see.
has_meta_key km km Indicates terminal has a meta key, such as shift or sets parity bit.
has_print_wheel daisy YC Indicates operator needed to change character set.
has_status_line hs hs Indicates terminal has a dedicated status line.
hue_lightness_saturation hls hl Uses HLS color notation (Tektronix).
insert_null_glitch in in Indicates insert mode distinguishes nulls.
lpi_changes_res lpix YG Indicates resolution changed when changing line pitch.
memory_above da da Display retained above the screen (usually multi-page terminals).
memory_below db db Display retained below the screen (usually multi-page terminals)
move_insert_mode mir mi Indicates safe to move while in insert mode.
move_standout_mode msgr ms Indicates safe to move in standout modes.
needs_xon_xoff nxon nx Indicates padding will not work, that xon/xoff is required.
no_esc_ctlc (or beehive_glitch) xsb xb Indicates a terminal with F1=escape and F2=Ctrl-C.
no_pad_char npc NP Indicates pad character does not exist.
non_dest_scroll_region ndscr ND Indicates non-destructive scrolling region.
non_rev_rmcup nrrmc NR Indicates smcup does not reverse rmcup.
over_strike os os Indicates terminal overstrikes.
prtr_silent mc5i 5i Indicates printer will not echo on screen.
row_addr_glitch xvpa YD Indicates only positive motion for vpa/mvpa caps.
semi_auto_right_margin sam YE Indicates printing in last column causes carriage return.
status_line_esc_ok eslok es Indicates escape can be used on the status line.
tilde_glitch hz hz Indicates terminal cannot print the ~ (tilde) character.
transparent_underline ul ul Overstrikes with underline character.
xon_xoff xon xo Indicates terminal uses xon/xoff handshaking.

Numeric Capabilities

Numeric capabilities are followed by the # (pound sign) character and a numeric value. The cols#80 capability indicates the terminal has 80 columns. The following are the numeric capabilities:

Numeric Capabilities
Variable Cap Name I.Code Description
buffer_capacity bufsz Ya Specifies the number of bytes buffered before printing.
columns cols co Specifies the number of columns in a line.
dot_horz_spacing spinh Yc Identifies the horizontal spacing of dots in dots per inch.
dot_vert_spacing spinv Yb Specifies vertical spacing of pins in pins per inch.
init_tabs it it Provides initial tabs every specified number of spaces.
label_height lh lh Specifies the number of rows in each label.
label_width lw lw Specifies the number of columns in each label.
lines lines li Specifies the number of lines on screen or page.
lines_of_memory lm lm Specifies the number of lines of memory if > lines. A value of 0 indicates a variable number.
magic_cookie_glitch xmc sg Indicates number of blank characters left by smso or rmso.
max_attributes ma ma Identifies the maximum combined video attributes the terminal can display.
max_colors colors Co Specifies the maximum number of colors supported.
max_micro_address maddr Yd Indicate the limit on use of mhpa and mvpa.
max_micro_jump mjump Ye Specifies the limit on use of the mcub1, mcuf1, mcuu1, and mcud1 capabilities.
max_pairs pairs pa Specifies the maximum number of color pairs supported.
maximum_windows wnum MW Specifies the maximum number of defineable windows.
micro_char_size mcs Yf Specifies the character step size when in micro mode.
micro_line_size mls Yg Identifies the line step size when in micro mode.
no_color_video ncv NC Indicates video attributes that cannot be used with colors.
num_labels nlab Nl Specifies the number of labels on the screen. This value starts at 1.
number_of_pins npins Yh Identifies the number of pins in the print-head.
output_res_char orc Yi Specifies the horizontal resolution in units per character.
output_res_horz_inch orhi Yk Specifies the horizontal resolution in units per inch.
output_res_line orl Yj Specifies the vertical resolution in units per line.
output_res_vert_inch orvi Yl Indicates vertical resolution in units per inch.
padding_baud_rate pb pb Indicates lowest baud rate where carriage-return and line-return padding is needed.
print_rate cps Ym Indicates print rate in characters per second.
virtual_terminal vt vt Indicates virtual terminal number.
wide_char_size widcs Yn Identifies the character step size when the terminal is in double-wide mode.
width_status_lines wsl ws Specifies the number of columns in status lines.

String Capabilities

You define string-valued capabilities, such as the el capability (clear to end of line) with a 2-character code, an = (equal sign), and a string ending with a , (comma). A delay in milliseconds can appear anywhere in a string capability. To define a delay, enclose the delay between a $< and a >. The following shows the el capability with a delay of 3:

el=\EK$<3>

The tputs subroutine provides padding characters for a delay. A delay can be a number, such as 20, or a number followed by an * (asterisk), such as 3*. An asterisk indicates that the required padding is proportional to the number of lines affected by the operation. The number given represents the required padding for each affected unit. (For insert character, the factor is the number of lines affected, which is always 1, unless the terminal has the xenl capability and the software supports it). If you specify an asterisk, it is sometimes useful to give a delay of the form a.b, such as 3.5, to specify a delay for each unit to tenths of milliseconds. You can only specify one decimal place.

The terminfo database provides several escape sequences in the string-valued capabilities for easy encoding of characters. The following escape codes are recognized:

Escape Code Meaning
\E,\e Escape
\n New line
\l Line feed
\r Carriage return
\t Tab
\b Backspace
\f Form feed
\s Space
\^ Caret
\\ Backslash
\, Comma
\: Colon
\nnn Character with octal value nnn
^x Ctrl-x for any appropriate x
\0 Null character. \0 actually produces \200, which does not end a string but behaves as a null character on most terminals.

The following conventions are used in the Description column of the String Capabilities table:

(G) Indicates that the string is passed through tparm, with parameters as given (#i).
(*) Indicates that padding can be based on the number of lines affected.
(#i) Indicates the ith parameter.
String Capabilities
Variable Cap Name I.Code Description
appl_defined_str apstr za Application-defined terminal string.
asc_chars acsc ac Alternate character set mapping of glyph to characters.
back_tab cbt bt Back tab.
bell bel bl Produces an audible signal (bell).
box_chars_1 box1 bx Box characters, primary set.
box_chars_2 box2 by Box characters, alternate set.
box_attr_1 batt1 Bx Attributes for box_chars_1.
box_attr_2 batt2 By Attributes for box_chars_2.
carriage_return cr cr Indicates carriage return. (*)
change_char_pitch cpi ZA Change number of characters per inch.
change_line_pitch lpi ZB Change number of lines per inch.
change_res_horz chr ZC Change horizontal resolution.
change_res_vert cvr XD Change vertical resolution.
char_padding rmp rP Specifies character padding when in replace mode.
change_scroll_region csr cs Changes scroll region to lines #1 through #2. (G)
char_set_names csnm Zy List of character set names.
clear_all_tabs tbc ct Clears all tab stops.
clear_margins mgc MC Clear left and right soft margins.
clear_screen clear cl Clears screen and puts cursor in home position. (*)
clr_bol el1 cb Clear to beginning of line, inclusive.
clr_eol el ce Clears to end of line.
clr_eod ed cd Clears to end of the display.(*)
color_bg_0 colb0 d0 Background color 0, black.
color_bg_1 colb1 d1 Background color 1, red.
color_bg_2 colb2 d2 Background color 2, green.
color_bg_3 colb3 d3 Background color 3, brown.
color_bg_4 colb4 d4 Background color 4, blue.
color_bg_5 colb5 d5 Background color 5, magenta.
color_bg_6 colb6 d6 Background color 6, cyan.
color_bg_7 colb7 d7 Background color 7, white.
color_fg_0 colf0 c0 Foreground color 0, black.
color_fg_1 colf1 c1 Foreground color 1, red.
color_fg_2 colf2 c2 Foreground color 2, green.
color_fg_3 colf3 c3 Foreground color 3, brown.
color_fg_4 colf4 c4 Foreground color 4, blue.
color_fg_5 colf5 c5 Foreground color 5, magenta.
color_fg_6 colf6 c6 Foreground color 6, cyan.
color_fg_7 colf7 c7 Foreground color 7, white.
column_address hpa ch Sets cursor column. (G)
command_character cmdch CC Indicates that a terminal command-prototype character can be set.
create_window cwin CW Define win #1 to go from #2, #3 to #4, #5.
cursor_address cup cm Indicates screen-relative cursor motion row #1, col #2. (G)
cursor_down cud1 do Moves cursor down one line.
cursor_home home ho Moves cursor to home position (if no cup addressing).
cursor_invisible civis vi Makes cursor invisible.
cursor_left cub1 le Moves cursor left one space.
cursor_mem_address mrcup CM Indicates memory relative cursor addressing. (G)
cursor_normal cnorm ve Makes cursor appear normal (undo vs or vi).
cursor_right cuf1 nd Indicates nondestructive space (cursor right).
cursor_to_ll ll ll Moves cursor to first column of last line (if no cup addressing).
cursor_up cuu1 up Moves cursor up one line.
cursor_visible cvvis vs Makes cursor very visible.
define char defc ZE Define a character in a character set.
delete_character dch1 dc Deletes character. (*)
delete_line dl1 dl Deletes line. (*)
dial_phone dial DI Dial phone number #1.
dis_status_line dsl ds Disables status line.
display_clock dclk DK Display time-of-day clock.
down_half_line hd hd Indicates subscript (forward 1/2 line feed).
ena_acs enacs eA Enable alternate character set.
enter_alt_charset_mode smacs as Starts alternate character set.
enter_am_mode smam SA Turn on automatic margins.
enter_blink_mode blink mb Enables blinking.
enter_bold_mode bold md Enables bold (extra bright)mode.
enter_bottom_mode btml bm Starts bottom line mode. This string capability is an aid for drawing tables and is valid only for aixterm and aixterm-m terminal definitions.
enter_ca_mode smcup ti Begins programs that use cup addresing.
enter_delete_mode smdc dm Starts delete mode.
enter_dim_mode dim mh Enables half-bright mode.
enter_doublewide_mode swidm ZF Enable double-wide printing.
enter_draft_quality sdrfq ZG Set draft quality print.
enter_insert_mode smir im Starts insert mode.
enter_italics_mode sitm ZH Enable italics.
enter_leftward_mode slm Zl Enable leftward carrige motion.
enter_lvert_mode lvert lv Starts left vertical line mode. This string capability is an aid for drawing tables. Valid only for aixterm and aixterm-m terminal definitions.
enter_micro_mode smicm ZJ Enable micro motion capabilities.
enter_near_letter_quality snlq ZK Set near-letter quality print.
enter_normal_quality snrmq ZL Set normal quality print.
enter_protected_mode prot mp Enables protected mode.
enter_reverse_mode rev mr Enables reverse video mode.
enter_rvert_mode rvert rv Starts right vertical line mode. This string capability is an aid for drawing tables and is valid only for aixterm and aixterm-m terminal definitions.
enter_secure_mode invis mk Enables blank mode (characters are invisible).
enter_shadow_mode sshm ZM Enable shadow printing.
enter_standout_mode smso so Begins standout mode.
enter_subscript_mode ssubm ZN Enable subscript printing.
enter_superscript_mode ssupm ZO Enable superscript printing.
enter_topline_mode topl tp Starts top line mode. This string capability is an aid for drawing tables and is valid only for aixterm and aixterm-m terminal definitions.
enter_underline_mode smul us Starts underscore mode.
enter_upward_mode sum ZP Enable upward carriage motion.
enter_xon_mode smxon SX Turn on xon/xoff handshaking.
erase_chars ech ec Erases #1 characters. (G)
exit_alt_charset_mode rmacs ae Ends alternate character set.
exit_am_mode rmam RA Turn off automatic margins.
exit_attribute_mode sgr0 me Disables all attributes.
exit_ca_mode rmcup te Ends programs that use cup addressing.
exit_delete_mode rmdc ed Ends delete mode.
exit_doublewide_mode rwidm ZQ Disable double-wide printing.
exit_insert_mode rmir ei Ends insert mode.
exit_italics_mode ritm ZR Disable italics.
exit_leftward_mode rlm ZS Enable rightward (normal) carriage motion.
exit_micro_mode micm ZT Disable micro motion capabilities.
exit_shadow_mode rshm ZU Disable shadow printing.
exit_standout_mode rmso se Ends standout mode.
exit_subscript_mode rsubm ZV Disable subscript printing.
exit_superscript_mode rsupm ZW Disable superscript printing.
exit_underline_mode rmul ue Ends underscore mode.
exit_upward_mode rum ZX Enable downard (normal) carrige motion.
exit_xon_mode rmxon RX Turn off xon/xoff handshaking.
flash_screen flash vb Indicates visual bell (may not move cursor).
fixed_pause pause PA Pause for 2-3 seconds.
flash_hook hook fh Flash the switch hook.
font_0 font0 f0 Select font 0.
font_1 font1 f1 Select font 1.
font_2 font2 f2 Select font 2.
font_3 font3 f3 Select font 3.
font_4 font4 f4 Select font 4.
font_5 font5 f5 Select font 5.
font_6 font6 f6 Select font 6.
font_7 font7 f7 Select font 7.
form_feed ff ff Ejects page (hardcopy terminal). (*)
from_status_line fsl fs Returns from status line.
goto_window wingo WG Go to window #1.
hangup hup HU Hang-up phone.
init_1string is1 i1 Initializes terminal.
init_2string is2 is Initializes terminal.
init_3string is3 i3 Initializes terminal.
init_file if if Identifies file containing is long initialization strings.
init_prog iprog iP Locates the program for initialization.
initialize_color initc Ic Initialize the color definition.
initialize_pair initp Ip Initialize color pair.
insert_character ich1 ic Inserts character.
insert_line il1 al Adds new blank line. (*)
insert_padding ip ip Inserts pad after character inserted. (*)
key_a1 ka1 K1 Specifies upper left of keypad.
key_a3 ka3 K3 Specifies upper right of keypad.
key_action kact kJ Sent by action key.
key_b2 kb2 K2 Specifies center of keypad.
key_backspace kbs kb Sent by backspace key.
key_beg kbeg @1 Beginning key. KEY_BEG
key_btab kcbt kB Sent by backtab key. KEY_BTAB
key_c1 kc1 K4 Specifies lower left of keypad.
key_c3 kc3 K5 Specifies lower right of keypad.
key_cancel kcan @2 Cancel key. KEY_CANCEL
key_catab ktbc ka Sent by clear-all-tabs key.
key_clear kclr kC Sent by clear screen or erase key.
key_close kclo @3 Close key. KEY_CLOSE
key_command kcmd @4 Command-request key.
key_command_pane kcpn @7 Command-pane key.
key_copy kcpy @5 Copy key. KEY_COPY
key_create kcrt @6 Create key. KEY_CREATE
key_ctab kctab kt Sent by clear tab key.
key_dc kdch1 kD Sent by delete-character key.
key_dl kdl1 kL Sent by delete-line key.
key_do kdo ki Do request key.
key_down kcud1 kd Sent by terminal down-arrow key.
key_eic krmir kM Sent by rmir or smir in insert mode.
key_end kend @7 End key. KEY_END
key_enter kent @8 Enter/send (unreliable). KEY_ENTER.
key_eol kel kE Sent by clear-to-end-of-line key.
key_eos ked kS Sent by clear-to-end-of-screen key.
key_exit kext @9 Exit key. KEY_EXIT.
key_f0 kf0 k0 Sent by function key F0.
key_f1 kf1 k1 Sent by function key F1.
key_f2 kf2 k2 Sent by function key F2.
key_f3 kf3 k3 Sent by function key F3.
key_f4 kf4 k4 Sent by function key F4.
key_f5 kf5 k5 Sent by function key F5.
key_f6 kf6 k6 Sent by function key F6.
key_f7 kf7 k7 Sent by function key F7.
key_f8 kf8 k8 Sent by function key F8.
key_f9 kf9 k9 Sent by function key F9.
key_f10 kf10 k; Sent by function key F10.
key_f11 kf11 F1 Sent by function key F11.
key_f12 kf12 F2 Sent by function key F12.
key_f13 kf13 F3 Sent by function key F13. KEY_F(13)
key_f14 kf14 F4 Sent by function key F14. KEY_F(14)
key_f15 kf15 F5 Sent by function key F15. KEY_F(15)
key_f16 kf16 F6 Sent by function key 16. KEY_F(16)
key_f17 kf17 F7 Sent by function key 17. KEY_F(17)
key_f18 kf18 F8 Sent by function key 18. KEY_F(18)
key_f19 kf19 F9 Sent by function key 19. KEY_F(19)
key_f20 kf20 FA Sent by function key 20. KEY_F(20)
key_f21 kf21 FB Sent by function key 21. KEY_F(21)
key_f22 kf22 FC Sent by function key 22. KEY_F(22)
key_f23 kf23 FD Sent by function key 23. KEY_F(23)
key_f24 kf24 FE Sent by function key 24. KEY_F(24)
key_f25 kf25 FF Sent by function key 25. KEY_F(25)
key_f26 kf26 FG Sent by function key 26. KEY_F(26)
key_f27 kf27 FH Sent by function key 27. KEY_F(27), 03543
key_f28 kf28 FI Sent by function key 28. KEY_F(28)
key_f29 kf29 FJ Sent by function key 29. KEY_F(29)
key_f30 kf30 FK Sent by function key 30. KEY_F(30)
key_f31 kf31 FL Sent by function key 31. KEY_F(31)
key_f32 kf32 FM Sent by function key 32. KEY_F(32)
key_f33 kf33 FN Sent by function key 33. KEY_F(33)
key_f34 kf34 FO Sent by function key 34. KEY_F(34)
key_f35 kf35 FP Sent by function key 35. KEY_F(35)
key_f36 kf36 FP Sent by function key 36. KEY_F(36)
key_f37 kf37 FQ Sent by function key 37. KEY_F(37)
key_f38 kf38 FR Sent by function key 38. KEY_F(38)
key_f39 kf39 FS Sent by function key 39. KEY_F(39)
key_f40 kf40 FT Sent by function key 40. KEY_F(40)
key_f41 kf41 FU Sent by function key 41. KEY_F(41)
key_f42 kf42 FV Sent by function key 42. KEY_F(42)
key_f43 kf43 FW Sent by function key 43. KEY_F(43)
key_f44 kf44 FX Sent by function key 44. KEY_F(44)
key_f45 kf45 FY Sent by function key 45. KEY_F(45)
key_f46 kf46 FZ Sent by function key 46. KEY_F(46)
key_f47 kf47 Fa Sent by function key 47. KEY_F(47)
key_f48 kf48 Fb Sent by function key 48. KEY_F(48)
key_f49 kf49 Fc Sent by function key 49. KEY_F(49)
key_f50 kf50 Fd Sent by function key 50. KEY_F(50)
key_f51 kf51 Fe Sent by function key f51. KEY_F(51)
key_f52 kf52 Ff Sent by function key f52. KEY_F(52)
key_f53 kf53 Fg Sent by function key f53. KEY_F(53)
key_f54 kf54 Fi Sent by function key f54. KEY_F(54)
key_f55 kf55 Fj Sent by function key f55. KEY_F(55)
key_f56 kf56 Fk Sent by function key f56. KEY_F(56)
key_f57 kf57 Fl Sent by function key f57. KEY_F(57)
key_f58 kf58 Fm Sent by function key f58. KEY_F(58)
key_f59 kf59 Fn Sent by function key f59. KEY_F(59)
key_f60 kf60 Fo Sent by function key f60. KEY_F(60)
key_f61 kf61 Fp Sent by function key f61. KEY_F(61)
key_f62 kf62 Fq Sent by function key f62. KEY_F(62)
key_f63 kf63 Fr Sent by function key f63. KEY_F(63)
key_find kfnd @0 Find key. KEY_FIND




key_help khlp kq Help key.
key_home khome kh Sent by home key.
key_ic kich1 kI Sent by insert-character/ enter-insert-mode key.
key_il kil1 kA Sent by insert line key.
key_left kcub1 kl Sent by terminal left-arrow key.
key_ll kll kH Sent by home-down key.
key_mark kmrk %2 Mark key. KEY_MARK
key_message kmsg %3 Message key. KEY_MESSAGE
key_move kmov %4 Move key. KEY_MOVE
key_newline knl kn New-line key.
key_next knxt %5 Next object key. KEY_NEXT
key_next_pane knpn kv Next-pane key.
key_npage knp kN Sent by next-page key.
key_open kopn %6 Open key. KEY_OPEN
key_options kopt %7 Options key. KEY_OPTIONS
key_ppage kpp kP Sent by previous-page key.
key_prev_pane kppn kV Sent by previous-pane key.
key_prev_cmd kpcmd kp Sent by previous-command key.
key_previous kprv %8 Previous object key. KEY_PREVIOUS
key_print kprt %9 Print or copy. KEY_PRINT
key_quit kquit kQ Quit key.
key_redo krdo %0 Redo key. KEY_REDO
key_reference kref &1 Reference key. KEY_REFERENCE
key_refresh krfr &2 Refresh key. KEY_REFRESH
key_replace krpl &3 Replace key. KEY_REPLACE
key_restart krst &4 Restart key. KEY_RESTART
key_resume kres &5 Resume key. KEY_RESUME
key_right kcuf1 kr Sent by terminal right-arrow key.
key_save ksav &6 Save key. KEY_SAVE
key_sbeg kBEG &9 Shifted beginning key. KEY_SBEG
key_scancel kCAN &0 Shifted cancel key. KEY_SCANCEL
key_scommand kCMD *1 Shifted command key. KEY_SCOMMAND
key_scopy kCPY *2 Shifted copy key. KEY_SCOPY
key_screate kCRT *3 Shifted create key. KEY_SCREATE
key_scroll_left kscl kz Scroll left.
key_scroll_right kscr kZ Scroll right.
key_sdc kDC *4 Shifted delete-character key. KEY_SDC
key_sdl kDL *5 Shifted delete-line key. KEY_SDL
key_select kslt *6 Select key.
key_send kEND *7 Shifted end key. KEY_SEND
key_seol kEOL *8 Shifted clear-line key. KEY_SEOL
key_sexit kEXT *9 Shifted exit key. KEY_SEXIT
key_sf kind kF Sent by scroll-forward/ scroll-down key.
key_sf1 ksf1 S1 Special function key 1.
key_sf2 ksf2 S2 Special function key 2.
key_sf3 ksf3 S3 Special function key 3.
key_sf4 ksf4 S4 Special function key 4.
key_sf5 ksf5 S5 Special function key 5.
key_sf6 ksf6 S6 Special function key 6.
key_sf7 ksf7 S7 Special function key 7.
key_sf8 ksf8 S8 Special function key 8.
key_sf9 ksf9 S9 Special function key 9.
key_sf10 ksf10 S0 Special function key 10.
key_sfind kFND *0 Shifted find key. KEY_SFIND
key_shelp kHLP #1 Shifted help key. KEY_SHELP
key_shome kHOM #2 Shifted home key. KEY_SHOME
key_sic kIC #3 Shifted input key. KEY_SIC
key_sleft kLFT #4 Shifted left-arrow key. KEY_SLEFT
key_smap_in1 kmpf1 Kv Input for special mapped key 1.
key_smap_in2 kmpf2 Kw Input for special mapped key 2.
key_smap_in3 kmpf3 Kx Input for special mapped key 3.
key_smap_in4 kmpf4 Ky Input for special mapped key 4.
key_smap_in5 kmpf5 Kz Input for special mapped key 5.
key_smap_in6 kmpf6 Kr Input for special mapped key 6.
key_smap_in7 kmpf7 Ks Input for special mapped key 7.
key_smap_in8 kmpf8 Kt Input for special mapped key 8.
key_smap_in9 kmpf9 Ku Input for special mapped key 9.
key_smap_out1 kmpt1 KV Output for mapped key 1.
key_smap_out2 kmpt2 KW Output for mapped key 2.
key_smap_out3 kmpt3 KX Output for mapped key 3.
key_smap_out4 kmpt4 KY Output for mapped key 4.
key_smap_out5 kmpt5 KZ Output for mapped key 5.
key_smap_out6 kmpt6 KR Output for mapped key 6.
key_smap_out7 kmpt7 KS Output for mapped key 7.
key_smap_out8 kmpt8 KT Output for mapped key 8.
key_smap_out9 kmpt9 KU Output for mapped key 9.
key_smessage kMSG %a Shifted message key. KEY_SMESSAGE
key_smove kMOV %b Shifted move key. KEY_SMOVE
key_snext kNXT %c Shifted next key. KEY_SNEXT
key_soptions kOPT %d Shifted options key. KEY_SOPTIONS
key_sprevious kPRV %e Shifted previous key. KEY_SPREVIOUS
key_sprint kPRT %f Shifted print key. KEY_SPRINT
key_sr kri kR Sent by scroll-backward key.
key_redo kRDO %g Shifted redo key. KEY_SREDO
key_replace kRPL %h Shifted replace key. KEY_REPLACE
key_sright kRIT %i Shifted right-arrow key. KEY_SRIGHT
key_srsume kRES %j Shifted resume key. KEY_SRSUME
key_ssave kSAV !1 Shifted save key. KEY_SSAVE
key_ssuspend kSPD !2 Shifted suspend key. KEY_SSUPEND
key_stab khts kT Sent by set-tab key.
key_sundo kUND !3 Shifted undo key. KEY_SUNDO
key_suspend kspd &7 Suspend key. KEY_SUSPEND
key_tab ktab ko Tab key.
key_undo kund &8 Undo key. KEY_UNDO
key_up kcuu1 ku Sent by terminal up-arrow key.
keypad_local rmkx ke Ends keypad transmit mode.
keypad_xmit smkx ks Puts terminal in keypad transmit mode.
lab_f0 lf0 l0 Labels function key F0, if not F0.
lab_f1 lf1 l1 Labels function key F1, if not F1.
lab_f2 lf2 l2 Labels function key F2, if not F2.
lab_f3 lf3 l3 Labels function key F3, if not F3.
lab_f4 lf4 l4 Labels function key F4, if not F4.
lab_f5 lf5 l5 Labels function key F5, if not F5.
lab_f6 lf6 l6 Labels function key F6, if not F6.
lab_f7 lf7 l7 Labels function key F7, if not F7.
lab_f8 lf8 l8 Labels function key F8, if not F8.
lab_f9 lf9 l9 Labels function key F9, if not F9.
lab_f10 lf10 la Labels function key F10, if not F10.
label_format fln Lf Label format.
label_off rmln LF Turn off soft labels.
label_on smln LO Turn on soft labels.
meta_on smm mm Enables meta mode (8th bit).
meta_off rmm mo Disables meta mode.
micro_column_address mhpa ZY Move N steps from the left.
micro_down mcud1 ZZ Move 1 step down.
micro_left mcub1 Za Move 1 step left.
micro_right mcuf1 Zb Move 1 step right.
micro_row_address mvpa Zc Move N steps from the top.
micro_up mcuu1 Zd Move 1 step up.
newline nel nw Performs new-line function (behaves like carriage return followed by line feed).
order_of_pins porder Ze Matches software bits to print-head pins.
orig_colors oc oc Original colors.
orig_pair op op Original color-pair.
pad_char pad pc Pads character (instead of NULL).
parm_dch dch DC Deletes #1 characters. (G)
parm_delete_line dl DL Deletes #1 lines. (G)
parm_down_cursor cud DO Moves cursor down #1 lines. (G*)
parm_down_micro mcud Zf Move N steps down. (G*)
parm_ich ich IC Inserts #1 blank characters. (G*)
parm_index indn SF Scrolls forward #1 lines. (G)
parm_insert_line il AL Adds #1 new blank lines. (G*)
parm_left_cursor cub LE Moves cursor left #1 spaces. (G)
parm_left_micro mcub Zg Move N steps left.
parm_right_cursor cuf RI Moves cursor right #1 spaces. (G*)
parm_right_micro mcuf Zh Move N steps right.
parm_rindex rin SR Scrolls backward #1 lines. (G)
parm_up_cursor cuu UP Moves cursor up #1 lines. (G*)
parm_up_micro mcuu Zi Move N steps up.
pkey_key pfkey pk Programs function key #1 to type string #2.
pkey_local pfloc pl Programs function key #1 to execute string #2.
pkey_xmit pfx px Programs function key #1 to transmit string #2.
plab_norm pln pn Program label #1 to show string #2.
print_screen mc0 ps Prints contents of the screen.
prtr_non mc5p pO Enables the printer for #1 bytes.
prtr_off mc4 pf Disables the printer.
prtr_on mc5 po Enables the printer.
pulse pulse PU Select pulse dialing.
quick_dial qdial QD Dial phone number #1, without progress detection.
remove_clock rmclk RC Remove time-of-day clock.
repeat_char rep rp Repeats #1 character #2 times. (G*)
req_for_input rfi RF Send next input char (for pty's).
reset_1string rs1 r1 Resets terminal to known modes.
reset_2string rs2 r2 Resets terminal to known modes.
reset_3string rs3 r3 Resets terminal to known modes.
reset_file rf rf Identifies the file containing reset string.
restore_cursor rc rc Restores cursor to position of last sc (save_cursor).
row_address vpa cv Positions cursor to an absolute vertical position (set row). (G)
save_cursor sc sc Saves cursor position.
scroll_forward ind sf Scrolls text up.
scroll_reverse ri sr Scrolls text down.
select_char_set scs Zj Select character set.
set_attributes sgr sa Defines the video attributes. (G) #1-#9
set_background setb Sb Set background color.
set_bottom_margin smgb Zk Set soft bottojm margin at current line.
set_bottom_margin_parm smgbp Zl Set soft bottom margin.
set_clock sclk SC Set time-of-day clock.
set_color_pair scp sp Set color pair.
set_foreground setf Sf Set foreground color.
set_left_margin smgl ML Set soft left margin.
set_left_margin_parm smglp Zm Set soft left margin.
set_right_margin smgr MR Set soft right margin.
set_right_margin_parm smgrp Zn Set soft right margin.
set_tab hts st Sets a tab in every row of the current column.
set_top_margin smgt Zo Set top margin at current line.
set_top_margin_parm smgtp Zp Set soft top margin.
set_window wind wi Indicates current window is lines #1-#2, columns #3-#4. (G)
start_bit_image sbim Zq Start printing bit-image graphics.
start_char_set_def scsd Zr Start definition of a character set.
stop_bit_image rbim Zs End printing bit image graphics.
stop_char_set_def rcsd Zt End definition of a character set.
subscript_characters subcs Zu List of charcters that can appear in subscript.
superscript_characters supcs Zv List of characters that can appear in superscript.
tab ht ta Tabs to next 8-space hardware tab stop.
these_cause_cr docr Zw Printing any of these characters cause a carrige return.
tone tone TO Select touch-tone dialing.
to_status_line tsl ts Moves to status line, column #1. (G)
underline_char uc uc Underscores one character and moves beyond it.
up_half_line hu hu Indicates superscript (reverse 1/2 line-feed)
user0 u0 u0 User string 0.
user1 u1 u1 User string 1.
user2 u2 u2 User string 2.
user3 u3 u3 User string 3.
user4 u4 u4 User string 4.
user5 u5 u5 User string 5.
user6 u6 u6 User string 6.
user7 u7 u7 User string 7.
user8 u8 u8 User string 8.
user9 u9 u9 User string 9.
wait_tone wiat WA Wait for dial tone.
xoff_character xoffc XF X-off character.
xon_character xonc XN X-on character.
zero_motion zerom Zx No motion for the subsequent character.

Preparing Descriptions

You can create a terminal description by copying and then modifying the description of a similar terminal. You can check the accuracy of your partial descriptions with the vi editor. Some terminals may reveal bugs in the vi editor as well as deficiencies in the ability of the terminfo database to provide a terminal description.

To test a new terminal description, set the TERMINFO environment variable to the path name of the directory containing the compiled description on which you are working. Programs then check that directory instead of the /usr/share/lib/terminfo directory.

To test for correct padding (if known), do the following:

  1. Edit the /etc/passwd file at 9600 baud.
  2. Delete about 16 lines from the middle of the screen.
  3. Press the u key several times quickly.

    If the terminal fails to display the result properly, more padding is usually needed. You can perform a similar test for insert character.

    Note: Excessive padding slows down the terminal.

Basic Capabilities

This section describes some basic terminal capabilities. If a terminal supports one of these capabilities, the terminal's terminfo source file entry indicates it. The following list is a list of basic capabilities:

am Indicates that the cursor moves to the beginning of the next line when it reaches the right margin. This capability also indicates whether the cursor can move beyond the bottom right corner of the screen.
bel Produces an audible signal (such as a bell or a beep).
bw Indicates that a backspace from the left edge of the terminal moves the cursor to the last column of the previous row.
clear Clears the screen, leaving the cursor in the home position.
cols Specifies the number of columns on each line for the terminal.
cr Moves the cursor to the left edge of the current row. This code is usually carriage return (Ctrl-M).
cub1 Moves the cursor one space to the left, such as backspace.
cuf1 Moves the cursor to the right one space.
cuu1 Moves the cursor up one space.
cud1 Move the cursor down one space.
hc Specifies a printing terminal with no softcopy unit. You should also specify the os capability.
ind Scrolls text up.
lf Specifies a line-feed.
lines Specifies the number of lines on a cathode ray tube (CRT) terminal.
nel Specifies a newline. The terminal behaves as if it received a carriage return followed by a line feed.
os Indicates that when a character is displayed or printed in a position already occupied by another character, the terminal overstrikes the existing character, rather than replacing it with the new character. The os capability applies to storage scope, printing, and APL terminals.
ri Scrolls text down.

If the LINES and COLUMNS environment variables are set, these variables override the values in the terminfo database.

The local cursor motions encoded in the terminfo database files are undefined at the left and top edges of a CRT terminal. Programs should never attempt to backspace around the left edge (unless the bw string is given) or to go up locally off the top.

To scroll text up, a program should go to the bottom left corner of the screen and send the index string. To scroll text down, a program goes to the top left corner of the screen and sends the reverse index string. The index string is specified by the ind capability and the reverse index string is specified by the ri capability. The index string and the reverse index string are undefined when not on their respective corners of the screen.

The am capability determines whether the cursor sticks at the right edge of the screen when text is output, but this does not necessarily apply when the cursor is moved to the right (the cuf1 capability) from the last column. A terminal has local motion from the left edge only if the bw capability is defined. The cursor then goes to the right edge of the previous row when moved to the left (the cub1 capability) from the left edge. If the terminal does not have the bw capability, the effect is undefined, which is useful for drawing a box around the edge of the screen, for example.

A terminal has switch-selectable automatic margins if the am capability is specified. If the terminal has a command that moves to the first column of the next line, you can define the nel (new-line) capability. It does not matter whether the command clears the remainder of the current line. Therefore, if the terminal has no cr and lf, a working nel can still be crafted out of one or both of them.

These capabilities suffice to describe printing terminals and simple CRT 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, xon,

Another terminal is described as:

xxxx | x | xxxxxxxx,
        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 are described by parameterized string capabilities. These strings have escape sequences similar to the printf %x format. For example, to address the cursor, you specify the cup capability using the row and column parameters.

The parameterized capabilities include:

cub1 Backspaces the cursor one space.
cup Addresses the cursor using the row and column parameters. Rows and columns are numbered starting with 0 and refer to the physical screen visible to the user, not to memory.
hpa and vpa Indicates the cursor has row or column absolute cursor addressing: horizontal position absolute (hpa) or vertical absolute (vpa).

Sometimes the hpa and vpa capabilities are shorter than the more general two-parameter sequence and you can use them in preference to the cup capability. Parameterized local motions (such as, a move of n spaces to the right) are defined with the cud, cub, cuf, and cuu capabilities, with a single parameter indicating how many spaces to move. These capabilities are primarily useful if the terminal does not have cup capability.

indn and rin Scrolls text. These are parameterized versions of the basic ind and ri capabilities. The n value is a number of lines.
mrcup Indicates the terminal has memory-relative cursor addressing.

The parameter mechanism uses a stack and has special % (percent sign) codes to manipulate the stack. Typically, a sequence pushes one of the parameters onto the stack and then prints it in some format. Often, more complex operations are necessary. The encodings have the following meanings:

%% Outputs a % (percent sign).
%[ [:] Flags] [Width [.Precision] ] [doxXs] As in the printf command, flags are the [- + # ] and space.
%d Prints pop() as in the printf command (numeric string from stack).
%2d Prints pop() like %2d (minimum 2 digits output from stack).
%3d Prints pop() like %3d (minimum 3 digits output from stack).
%02d Prints as in the printf command (2 digits output).
%03d Prints as in the printf command (3 digits output).
%c Prints pop() gives %c (character output from stack).
%s Prints pop() gives %s (string output from stack).
%p[i] Pushes the ith parameter onto the stack where i is a number between 1 and 9.
%P[a-z] Sets variable [a-z] to pop() (variable output from stack).
%g[a-z] Gets variable [a-z] and pushes it onto the stack.
%'c' Character constant c.
%{nn} Integer constant nn.
%l Push strlen (pop( ))
%+ %- %* %/ %m Arithmetic operators (%m is modulus): push (pop() operation pop()).
%& %| %^ Bit operations: push (pop() operation pop()).
%= %> %< Logical operations: push (pop() operation pop()).
%! %~ Unary operations: push (operation pop()).
%i Add 1 to first two parameters (for ANSI terminals).
%?expr %t thenpart %e elsepart %; If-then-else. The %e elsepart is optional. You can make an else-if construct as with Algol 68 in the following example, where ci denotes conditions and bi bodies.
%? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e b4 %;

Binary operations are in postfix form with the operands in the usual order. That is, to get - 5 use %gx%{5}%-.

If you use the - (minus sign) flag with %[doxXs], then you must place a colon between the % (percent sign) and the - (minus sign) to differentiate the flag from the %- binary operation, for example, %:-16.16s.

Consider a terminal that needs to be sent \E&a12c03Y padded for 6 milliseconds to get to row 3 and column 12. Here the order of the rows and columns is inverted, and the row and column are zero-padded as two digits. Thus, the cup capability of this terminal is cup=\E&a%p2%2.2dc%p1%2.2dY$<6>.

Some terminals need the current row and column sent, preceded by a ^T, with the row and column encoded in binary: cup=^T%p1%c%p2%c. Terminals that 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 characters, since the system may change or discard them.

Note: The library routines dealing with the terminfo database files set terminal modes so that tabs are not expanded by the operating system; thus, \t (tab) is safe to send.

A final example is a terminal that uses row and column offset by a blank character: cup=\E=%p1%'\s'%+%c%p2'\s'%+%c. After sending \E=, this operation 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

The top left corner of the screen is the home position. If the terminal has a fast way to get the cursor to the home position, specify the home capability. Specify, a fast way of getting to the bottom left corner with the ll capability. This method may involve going up (cuu1) from the home position, but a program should never do this itself (unless ll does) because the effect of moving up from the home position is not certain.

Note: The home position is the same as addressing (0,0) to the top left corner of the screen, not of memory.

If the terminal has row or column absolute-cursor addressing, you should specify the single hpa capability (horizontal position above) and the vpa capability (vertical position absolute). Sometimes these are shorter than the more general two parameter sequence and you can use them instead of the cup capability.

If the terminal has parameterized local motions for example, it is capable of moving the cursor n spaces right, you can specify the cud, cub, cuf, and cuu capabilities with a single parameter indicating how many spaces to move. These capabilities are useful if the terminal does not have the cup capability.

Area Clears

The following capabilities clear large areas of the terminal:

ed Clears from the current position to the end of the display. This is defined only 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.)
el Clears from the current cursor position to the end of the line without moving the cursor.
el1 Clears from the beginning of the line to the current position, inclusive. The cursor is not moved.

Scrolling

The following insert-line and delete-line capabilities are used to indicate a terminal can:

csr Change the scrolling region. This capability takes two parameters: the top and bottom lines of the scrolling region. The top line of the screen is 0. After using this capability, the cursor position is undefined. See the sc and rc capabilities in this section.
da Retain the display above the screen. If a line is deleted or the screen is scrolled, non-blank lines can be brought in at the top. This capability is usually defined for multipage terminals.
db Retain the display below the screen. If a line is deleted or the screen is reverse scrolled, the terminal can bring the non-blank lines at the bottom. This capability is usually defined for multipage terminals.
dl1 Delete the line the cursor is on. This is done only from the first position on the line to be deleted. Additionally, the dl capability takes a single parameter indicating the number of lines to be deleted.
il1 Create a new blank line before the line where the cursor is currently located and scrolls the rest of the screen down. This is done only from the first position of a line. The cursor then appears on the newly blank line. Additionally, the il capability can take a single parameter indicating the number of lines to insert.
ind Index or scroll forward. A terminal with this capability can shift the display up one line by deleting the top line and adding a blank line at the bottom.
indn Specify the number of lines to scroll forward. This capability has meaning only if the ind capability is also defined.
rc Restore the cursor. This capability is useful with the csr and sc capabilities.
ri Reverse scrolling. With this capability, the terminal can shift the screen down by deleting the bottom line and adding a blank line at the top.
rin Specify the number of lines to reverse scroll. This capability has meaning only if the ri capability also is defined.
sc Save the cursor. If defined, you can use the sc capability to save the cursor before using the csr capability. Saving the cursor is necessary because the cursor position is undefined after you use the csr capability. Use the rc capability to restore the cursor to the position it held before you used the csr capability.
wind Indicates the terminal has the ability to define a window as part of memory. This is a parameterized string capability with four parameters: the starting and ending lines in memory and the starting and ending columns in memory, in that order.

A terminal that has the csr capability can scroll part of its screen while leaving other lines above and below the region untouched. A forward scroll applied to a region deletes the top of the region, shifts, and adds a line to the bottom of the region. When finished with the scrolling region, you should use the csr capability to restore the scrolling region to the full screen.

Be sure you move the cursor into the scrolling region with the cup capability before you attempt to scroll the region. You should not move the cursor from the region until you are done with it.

Note: If you are using a terminals csr capability, you may also need to use the sc and rc capability.

Terminals that have csr defined have a destructive scrolling region. Once a line is scrolled off the screen, the terminal cannot retrieve it. A terminal with a non-destructive scrolling region can restore scrolled lines by reversing the scrolling. Unless the ind, ri, indn, rin, dl, and dl1 all simulate destructive scrolling, do not specify the csr capability if the terminal has non-destructive scrolling regions.

On multipage terminals, scrolling can put a line onto another page and scrolling in the opposite direction brings the line back. Similarly, deleting a line can cause a line from another page to appear on the screen. Multipage terminals should have the da and db capabilities defined so that program that use scrolling can adjust their behavior.

A few terminals can define a window as part of memory. For these types of terminals, all clearing, deletion, insertion, and wrapping commands affect the area in memory where the window is defined.

Insert or Delete Character

Generally, terminals handle insert/delete character operations in one of two ways. The most common insert/delete character operations affect only the characters on the current line and shift characters to the right and off the line. Other terminals make a distinctions between typed and untyped blanks on the screen. When inserting a character, the displayed data is shifted and an untyped blank is eliminated. Once all the untyped blanks are eliminated, the displayed data wraps to the next line if you continue to insert characters. When deleting a character, an untyped blank is added to the line to compensate for the deleted character.

Generally, terminals insert/delete characters in one-line mode or multiline mode. The two types of terminals also handle untyped spaces differently. One-line mode is the most common mode. In one-line mode, insert/delete character operations affect only the characters on the current line. Insertions shift characters to the right and off the line.

Multiline mode terminals can affect more than one line. In this mode, the terminal makes a distinction between typed and untyped blanks on the screen. Inserting a character on a multiline mode terminal shifts the displayed data and eliminates untyped blanks. If all the untyped blanks are eliminated and you continue to insert characters, the display wraps to the next line. When deleting a character, multiline terminals add an untyped blank to the line to compensate for the deleted character.

Determining Your Terminal's Type

Clearing a screen and then typing text separated by cursor motions helps you determine the type of insert/delete operations your terminal performs. Clear the screen, then proceed as follows:

  1. Type abc  def using local cursor movements, not spaces, between the abc and the def.
  2. Position the cursor before the abc.
  3. Place the terminal in insert mode.
  4. Type a line of text. If your typing causes the abc def characters to shift right and exit the right side of the display, the terminal does not distinguish between blanks and untyped positions.

    If the abc moves to positions to the immediate left of the def and the characters move to the right on the line, around the end, and to the next line, the terminal is the second type. This is described by the in capability, which signifies insert null.

Although these two attributes (one-line versus multiline insert mode, and different treatment of untyped spaces) are logically separate, there are no known terminals whose insert mode cannot be described with a single attribute.

Insert or Delete Character Capabilities

The terminfo database describes terminals that have an insert mode as well as terminals that send a simple sequence to open a blank position on the current line. The following are used to describe insert/delete character capabilities:

dch1 Deletes a single character. The dch capability with one parameter, n, deletes n characters.
ech Replaces the specified number of characters, starting at the cursor, with blanks. The cursor position remains unchanged.
ich1 Opens a space in a line for a character to be inserted. This sequence precedes the actual character insertion. Terminals with a true insert mode would not use this capability.
ip Indicates post-padding needed. This is given as a number of milliseconds. Any other sequence that may need to be sent after inserting a single character can be given in this capability.
mir Allows cursor movement while in insert mode. It is sometimes necessary to move the cursor while in insert mode to delete characters on the same line. Some terminals may not have this capability due to their handling of insert mode.
rmdc Exits delete mode.
rmir Ends insert mode.
rmp Indicates that padding is necessary between characters typed while not in insert mode. This capability is used in replace mode.
smdc Enters delete mode.
smir Begins insert mode.

If you are creating a terminfo description for a terminal that requires an insert mode and also needs a special code to precede each inserted character, then define the smir/rmr, and ich1 capabilities. The ich capability, with the one parameter n, opens up n spaces so that n characters can be inserted.

Highlighting, Underlining, and Visual Bells

If your terminal has one or more kinds of display attributes, such as highlighting, underlining, and visual bells, you can present these in a number of ways. Highlighting, such as standout mode, presents a high-contrast, easy-to-read format that adds emphasis to error messages and other important messages. Underlining is another method to focus attention on a particular portion of the terminal. Visual bells include methods such as flashing the screen. The following capabilities describe highlighting, underlining, and visual bells:

blink Indicates terminal has blink highlighting mode.
bold Indicates terminal has extra bright highlighting mode.
civis Makes the cursor invisible.
cnorm Displays a normal cursor. This capability reverses the effects of the civis and cvvis capabilities.
cvvis Makes the cursor more visible than normal when it is not on the bottom line.
dim Indicates the terminal has half-bright highlighting modes.
eo Indicates that blanks erase overstrikes.
enacs Specifies a command string that enables alternate character set mode. Some terminals cannot enter alternate character set mode without first receiving a specific command. The enacs capability defines the command.
flash Indicates the terminal has a way of making the screen flash (as a bell replacement) for errors, without moving the cursor.
invis Indicates the terminal has blanking or invisible-text highlighting modes.
msgr Indicates it is safe to move the cursor in standout mode. Otherwise, programs using standout mode should exit this mode before moving the cursor or sending a new-line. Some terminals automatically leave standout mode when they move to a new line or when the cursor is addressed.
nrrmc Indicates that the smcup sequence does not restore the screen after a rmcup sequence is output. This means that you cannot restore the screen to the state prior to outputting rmcup.
os Indicates the terminal can overstrike an existing character without erasing the original. Overstriking creates a compound character.
prot Indicates the terminal has protected text mode. This means the terminal protects the text from overwriting or erasing. The method of protection is terminal dependent.
rev Indicates the terminal has reverse-video mode.
rmacs Exits the alternate character set mode.
rmso Exits standout mode.
rmul Ends underlining.
sgr Provides a sequence to set arbitrary combinations of attributes. The sgr capability can set nine attributes. In order, these attributes are the following:
standout
underline
blink
dim
bold
blank
protect
alternate character set

To turn a mode on, set it to a nonzero value. To turn a mode off, set it to 0. The sgr capability can only support those modes for which separate capabilities already exist on the terminal.

sgr0 Turns of all the special modes, including the alternate character set.
smacs Enters the alternate character set mode.
smcup and rmcup Indicate the terminal must be in a special mode when running a program that uses any of the highlighting, underlining, or visual bell capabilities. The smcup capability enters this mode, and the rmcup capability exits this mode.

This need arises, for example, with terminals having more than one page of memory. If the terminal has only memory-relative cursor addressing, and not screen-relative cursor addressing, a screen-sized window must be fixed into the terminal for cursor addressing to work properly. This is also used when the smcup capability sets the command character to be used by the terminfo database file.

smso Enters standout mode.
smul Begins underlining.
uc Underlines the current character and moves the cursor one space to the right.
ul Indicates the terminal correctly generates underlined characters (with no special codes needed), even though it does not overstrike.
xmc Indicates the number of blanks left if the capability to enter or exit standout mode leaves blank spaces on the screen.

Highlighting, Overstriking, and Underlining

You should choose one display method as standout mode and use it to highlight error messages and other kinds of text to which you want to draw attention. For example, you could choose reverse-video plus half-bright or reverse-video alone. The sequences to enter and exit standout mode are given by the smso and rmso capabilities. If the code to change into or out of standout mode leaves one or even two blank spaces on the screen, then xmc should be given to tell how many spaces are left.

You should specify the ul boolean capability if your terminal generates underlined characters by using the underline character with no special codes. You should specify this capability even if the terminal does not otherwise overstrike characters. For terminals where a character overstriking another leaves both characters on the screen, specify the os capability. If the terminal can erase overstrikes with a blank, then indicate this by specifying the eo capability.

Example of Using the sgr Capability

The following example demonstrates how to use the sgr capability to turn on various modes. Assume that you must define a terminal that requires the following escape sequences to turn on various modes:

Terminfo Parameter Mode Escape Sequence

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.

You can simulate some modes by combining others. In this example, the standout attribute escape sequence is a combination of the reverse and dim sequences. Also, in the example the bold sequence is a combination of the reverse and underline sequences. To combine such modes as underline and blink, the sequence to use would be \E[0;3;5m.

You cannot simulate certain modes by combining others. For example, you cannot simulate the protect mode. In this example, the system ignores the p8 parameter. The altcharset mode is different in that it is either ^O or ^N, depending on whether the alternate character mode set is on or off. If all modes were turned on, the sequence would appear as \E[0;3;4;5;7;8m^N.

Some sequences are outputted for one or more modes. For example, the ;3 is outputted when either the p2 parameter or p6 parameter is true. If you write out the above sequences along with their dependencies, the result is 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 %?%p1%t;8%;
m always m
^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%;

The final result would produce a sgr sequence that appears as follows:

sgr=\E[0%?%p2%p6%|%t;3%;%?%p1%p3%|%p6%|%t;4%;%?%p4%t;5;%?%p1%p5%|
%t;7%;%?%p1%t;8%;m%?%p9%t^N%e^O%;,

Keypad

If the terminal has a keypad that transmits codes when the keys are pressed, you can define this in the terminfo entry for the terminal. It is not possible to handle terminals where the keypad only works in local mode. 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.

To define the codes sent by the left-arrow, right-arrow, up-arrow, down-arrow, and home keys, use the kcub1, kcuf1, kcud1, and khome capabilities, respectively. If there are function keys such as F0, F1, ..., F63, the codes they send can be given as the kf0, kf1, ..., kf63 capabilities. If the first eleven keys have labels other than the default F0 through F10, you can specify the labels with the lf0, lf1, ..., lf10 capabilities. The codes transmitted by certain other special keys can be defined with:

kbs Backspace key.
kclr Clear-screen or erase key.
kctab Clear the tab stop in this column.
kdch1 Delete-character key.
kdl1 Delete-line key.
ked Clear to end of screen.
kel Clear to end of line.
khts Set a tab stop in this column.
kich1 Insert character or enter insert mode.
kil1 Insert line.
kind Scroll forward or down, or both.
kll Home down key (home is the lower left corner of the display, in this instance).
krmir Exit insert mode.
knp Next page.
kpp Previous page.
ktbc Clear-all-tabs key.
ri Scroll backward or up, or both.

In addition, if the keypad has a three-by-three array of keys including the four arrow keys, specify the other five keys as ka1, ka3, kb2 kc1, and kc3. These keys are useful when you need the effects of a three-by-three directional pad.

Strings that program function keys can be given as the pfkey, pfloc, and pfx capabilities. A string to program the 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 with which to program it. Function key numbers out of this range can program undefined keys in a terminal-dependent manner. The capabilities differ in that pfkey causes pressing a given key to be the same as the user typing the given string, pfloc causes the string to be executed by the terminal in local mode, and pfx causes the string to be transmitted to the computer. The capabilities nlab, lw, and lh define the number of soft labels and the width and height. Use smln and rmln to specify the commands for turning on and off soft labels. smln is normally output after one or more pln sequences to ensure the change becomes visible.

Tabs and Initialization

If the terminal has hardware tabs, you can use ht capability (usually Ctrl-I) to specify the command to advance to the next tab stop. To specify the command to move left toward the previous tab stop, use the cbt capability. By convention, if the terminal modes indicate that operating system is expanding the tabs rather than sending them to the terminal, programs should not use the ht or cbt capabilities even if they are present, since the user may not have the tab stops properly set.

If the terminal has hardware tabs that are initially set every n spaces when the terminal is powered up, its terminfo description should define the numeric capability it to show the number of spaces the tabs are set to. Normally, the tput init command uses the it parameter 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.

Other, similar capabilities include the is1, is2, and is3 initialization strings for the terminal; the iprog capability that specifies the terminal's initialization program, and the if capability that identifies 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 file description. They are normally sent to the terminal by the tput init command each time the user logs in. When the user logs in, the system does the following:

You can set up special terminal modes without duplicating strings by putting the common sequences in the is2 capability and special cases in the is1 and is3 capabilities. To specify sequences that do a harder reset from a totally unknown state, specify the rs1, rs2, rs3, and rf capabilities that are the same as is1, is2, is3, and the if capabilities.

A few terminals use the if and rf files. However, the recommended method is to use the initialization and reset strings. These strings are output by the tput reset command. This command is used when the terminal starts behaving strangely or is not responding at all. Commands are normally placed in the rs1, rs2, rs3 and rf capabilities only if they produce annoying effects on the screen and are not necessary when logging in. For example, the command to set the terminal into 80-column mode would normally be part of is2, but it causes an annoying screen behavior and is not necessary since most terminals initialize in 80-column mode.

If there are commands to set and clear tab stops, specify them using the tbc (clear all tab stops) and the hts (set a tab stop in the current column of every row) capabilities. If a more complex sequence is needed to set the tabs, the place the sequence in the is2 or the if capability.

The mgc capability can clear any margin. For more information about how to set and clear margins, see Margins.

Miscellaneous Strings

If the terminal requires a character other than a null character as a pad, then specify the pad string. Only the first character of the pad string is used. If a terminal does not have a pad character, specify the npc capability.

If the terminal can move up or down half a line, define the hu (half-line up) and hd (half-line down) capabilities. These capabilities are primarily useful for superscripts and subscripts on hardcopy terminals. If a hardcopy terminal can eject to the next page (form feed), specify the as ff (usually Ctrl-L) capability.

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 rep parameterized string. The first parameter is the character to be repeated, and the second is the number of times to repeat it. Thus following:

tparm(repeat_char,'x',10)

is the same as

xxxxxxxxxx

If the terminal has a settable command character, such as the Tektronix 4025, indicate this with the cmdch capability. A prototype command character is chosen that is used in all capabilities. This character is given in the cmdch capability to identify it. On some UNIX systems, if the CC environment variable exists, all occurrences of the prototype character are replaced with the character in the CC variable.

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. This capability allows programs to return errors if they cannot talk to the terminal. The gn capability does not apply to virtual terminal descriptions for which the escape sequences are known. If a terminal is supported by the UNIX system virtual terminal protocol, use the vt capability to define its terminal number.

If a terminal uses xon/xoff handshaking for the flow control, its description should include the xon capability. You should still include padding information as well so that routines can make better decisions about costs. However, actual pad characters are not transmitted. To specify sequences to turn on and off xon/xoff handshaking, use the smxon and rmxon capabilities. If the characters used for handshaking are not ^S and ^Q, use the xonc and xoffc capabilities to define them.

If a terminal has a meta key that acts as a shift key to set the eighth bit of any character transmitted, identify the key with the km capability. Otherwise, software assumes that the eighth 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 the smm and rmm capabilities.

If a terminal has more lines of memory than fit on the screen at once, use the lm capability to define the number of lines of memory. A value of lm#0 indicates that the number of lines is not fixed, but that there are still more lines of memory than fit on the screen.

Media copy strings that control an auxiliary printer connected to the terminal are identified with the following capabilities:

mc0 Prints the contents of the screen
mc4 Turns off the printer, and
mc5 Turns on the printer. When the printer is on, all text sent to the terminal is sent to the printer. It is undefined whether the text is also displayed on the terminal screen when the printer is on.
mc5p Leaves the printer on for a specified number of characters and then turns the printer off. The parameter passed to mc5p should not exceed 255.

If the terminal screen does not display the text when the printer is on, specify the mc5i capability to signify a silent printer. All text, including the mc4, is transparently passed to the printer while an mc5p is in effect.

Status Lines

You can use the terminfo entry to indicate that the terminal has an extra status line that is not normally used by software,. If the status line is viewed as an extra line below the bottom line, into which the cursor can be addressed normally, the hs capability should be given. Special strings to go to the beginning of the status line and to return from the status line can be given as the tsl and fsl capabilities, respectively. (The fsl must leave the cursor position in the same place it was before the tsl. If necessary, the sc string and the rc string can be included in tsl and fsl to get this effect.) The tsl capability takes one parameter, which is the column number of the status line to which the cursor is to be moved.

If escape sequences and other special commands, such as tab, work while in the status line, specify the eslok capability. A string that 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 capabilities. The status line is normally assumed to be the same width as the rest of the screen, such as 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 wsl numeric parameter.

Line Graphics

If the terminal has a line drawing alternate character set, specify the mapping of glyph to character in the acsc capability. 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&T4410v1 terminal. Use the following to define the string:

Glyph Name vt100+ Character
arrow pointing right +
arrow pointing left ,
arrow pointing down .
solid square block 0
lantern symbol I
arrow pointing up -
diamond '
check board (stipple) a
degree symbol f
plus or minus sign 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 would produce the appropriate glyph when the terminal is in alternate character set mode. For example:

glyph name               vt100           tty
                         character       character
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               .

Then, you specify the acsc capability by specifying the characters from left to right as follows:

acsc=lRmFkTjGq\,x.

Color Manipulation

There are two methods of color manipulation, the HP method and the Tektronix method. Most existing color terminals belong to one of these two classes. The Tektronix method uses a set of N predefined colors (usually 8) from which a user can select current foreground and background colors. Thus, the terminal can support up to N colors mixed into N*N color-pairs that are displayed on the screen at the same time.

The HP method restricts the user from both defining the foreground independently of the background or the background independently of the foreground. Instead, the user must define an entire color-pair at once. Up to M color-pairs, made from 2*M different colors, can be defined this way.

The numeric variables colors and pairs define the number of colors and color-pairs that the terminal can display on the screen at one time. If a terminal can change the definition of a color, you should specify the ccc capability. To change the definition of a color using the Tektronix method, use the initc capability. This capability requires four parameters: a color number ranging from 0 to colors-1 and three Red, Green, Blue (RGB) values ranging from 0 to 1,000.

Tektronix 4100 series terminals use a type of color notation called HLS (Hue Lightness Saturation) instead of RGB color notation. For such terminals, you should define the hls boolean capability. The last three arguments to the initc capability would then be HLS values where H ranges from 0 to 360 and L and S range from 0 to 100.

Note: If a terminal can change the definitions of colors but uses a color notation different from RGB or HLS, you must develop a mapping to either RGB or HLS.

To set current foreground and background to a given color, use the setf and setb capabilities. These capabilities require a single parameter that specifies the number of the color. To use the HP method to initialize a color-pair, use the initp capability. This capability requires seven parameters:

When you use the initc or initp capabilities, be sure you specify the values in the order red, green, blue or hue, lightness, saturation, respectively. To make a color-pair current, use the scp capability. This capability takes one parameter, the number of the color-pair.

Some terminals erase areas of the screen with the current background color. In such cases, define the bce capability. The op capability contains a sequence for setting the foreground and the background colors to what they were at the terminal start-up time. Similarly, the oc capability contains a control sequence for setting all colors or -pairs to the values they had at the terminal start-up time.

Some color terminals substitute color for video attributes. Such video attributes should not be combined with colors. You should pack information about these video attributes into the ncv capability. There is a one-to-one correspondence between the nine least significant bits of that variable and the video attributes. The following table depicts this correspondence:

Attribute NCV Bit Number
A_STANDOUT 0
A_UNDERLINE 1
A_REVERSE 2
A_BLINK 3
A_DIM 4
A_BOLD 5
A_INVIS 6
A_PROTECT 7
A_ALTCHARSET 8

When a particular video attribute should not be used with colors, the corresponding ncv bit should be set to 1. Otherwise, set the bit to 0. For example, if the terminal uses colors to simulate reverse video and bold, bits 2 and 5 should be set to 1. The resulting values for ncv will be 22.

Special Cases

Some terminals require special support by the terminfo database. These terminals are not deficient. These terminals have hardware that may be slightly different than what the terminfo database expects of most terminals. Some of the special cases are discussed in this section. The programmer's manual for a terminal should provided all the information you need to code a terminfo description for the terminal.

For terminals that do not allow the ~ (tilde) character, use the hz capability.

Descriptions of terminals that ignore a line-feed character immediately after an am wrap should include the xenl capability. Those terminals whose cursor remains on the right-most column until another character is received rather than wrapping immediately upon receiving the right-most character, should also use the xenl capability.

If el capability is required to get rid of standout (instead of merely writing normal text on top of it), then you should specify xhp capability.

Terminals for which tabs change all moved characters into blanks should indicate the xt capability (destructive tabs). This capability is interpreted to mean that it is not possible to position the cursor on top of the pads inserted for standout mode. Instead, it is necessary to erase standout mode using delete and insert line.

A terminal that is unable to correctly transmit the ESC (escape) or Ctrl-C characters should specify the xsb capability, indicating that the F1 key is used for ESC and the F2 key is used for Ctrl-C.

Other specific terminal problems can be corrected by adding more capabilities.

Similar Terminals

If two terminals are very similar, you can define one as being just like the other with the use string capability. You can also use all of the definitions from an existing description and identify exceptions. The capabilities given before the use capability override those in the terminal type called by the use capability. To cancel a capability place xx@ to the left of the use capability definition, where xx is the capability. For example, the entry:

term-nl | Terminal smkx@, rmkx@, use=term

defines a terminal that does not have either the smkx or the rmkx capability, and hence does not turn on the function key labels when in visual mode. This is useful for different terminal modes or for different user preferences. You can specify more than one use capability.

Printer Capabilities

The terminfo database allows you to define the capabilities of printers as well as terminals. To find out what capabilities are available for printers as well as for terminals, see the two lists under Terminal Capabilities that the list the capabilities by variable and by capability name.

Rounding Values

Because parameterized string capabilities work only with integer values, we recommend that terminfo designers create strings that expect rounded numeric values. Programmers should always round values to the nearest integer before using them with a parameterized string capability.

Printer Resolution

A printer's resolution is the smallest spacing of characters it can achieve. In general, printers have independent resolution horizontally and vertically. To determine the vertical resolution of a printer, measure the smallest achievable distance between consecutive printing baselines. To determine the horizontal resolution, measure the smallest achievable distance between the left-most edges of consecutive printed, identical, characters.

The terminfo database assumes all printers are capable of printing with a uniform horizontal and vertical resolution. The terminfo database currently interacts with printers as if they print inside a uniform matrix. All characters are printed at fixed positions relative to each cell in the matrix. Furthermore, each cell has the same size given by the smallest horizontal and vertical step sizes dictated by the resolution.

Many printers are capable of proportional printing where the horizontal spacing depends on the size of the last character printed. The terminfo database does not make use of this capability, although it does provide enough capability definitions to allow an application to simulate proportional printing.

A printer must not only be able to print characters as close together as the horizontal and vertical resolutions suggest, but also of moving to a position that is an integral multiple of the smallest distance away from a previous position. Thus, printed characters can be spaced apart a distance that is an integral multiple of the smallest distance, up to the length of width of a single page.

Some printers can have different resolutions depending on different modes. In normal mode, the existing terminfo capabilities are assumed to work on columns and lines, just like a video terminal. For example, the old lines capability specify the length of a page in lines, and the cols capability specifies the width of a page in columns. In micro mode many terminfo capabilities work on increments of lines and columns. With some printers, the micro mode may exist concurrently with normal mode, so that all the capabilities work at the same time.

Specifying Printer Resolution

You can specify a printer's printing resolution with several different capabilities. Each capability specifies distance in a different way. The following capabilities define print resolution:

Capability Defined as
orhi steps per inch horizontally
orvi steps per inch vertically
orc steps per column
orl steps per line

When printing in normal mode, each character printed causes the printer to move to the next column, except in special cases described later. The distance moved is the same as the per-column resolution. Some printers cause an automatic movement to the next line when a character is printed in the rightmost position. The vertical distance moved is the same as the per-line resolution. When printing in micro mode, these distances can be different, and may be zero for some printers. The following specify printer resolution automatic motion after printing:

Capability Defined as
orc Steps moved horizontally in normal mode.
orl Steps moved vertically in normal mode.
mcs Steps moved horizontally in micro mode.
mls Steps moved vertically in micro mode.

Some printers can print wide characters. The distance moved when a wide character is printed in normal mode may be different from when a regular width character is printed. The distance moved when a wide character is printed in micro mode may also be different from when a regular character is printed in micro mode, but the differences are assumed to be related.

If the distance moved for a regular character is the same in normal mode or micro mode (mcs=ocs), then the distance moved for a wide character is also the same in both modes. This does not mean the normal character distance is necessarily the same as the wide character distance, just that the distances do not change with a change from normal to micro mode. Use the widcs capability to specify the printer resolution when the automatic motion after printing a wide character is the same in both normal or micro mode.

If the distance moved for a regular character is different in micro mode from the distance moved in normal mode (mcs<orc), you can assume the micro mode distance is the same for a wide character printed in micro mode. In this case, you use the mcs capability to specify the distance moved. The printer uses the value you specify for both regular and wide characters

A printer may use control sequences to change the number of columns per inch (the character pitch) and to change the number of lines per inch (the line pitch). If these are used, the resolution of the printer changes but the type of change depends on the printer.

Capability Defined as
cpi Change character pitch.
cpix If set, cpi changes orhi, otherwise the cpi capability changes the orc value.
lpi Change line pitch
lpix If set, lpi changes the orvi value, otherwise the orl value is changed.
chr Changes steps per column.
cvr Changes steps per line.

The cpi and lpi string capabilities have a single argument, the pitch in columns (or characters) and lines per inch, respectively. The chr capability and cvr string capabilities each have a single argument, the number of steps per column and line, respectively.

Using any of the control sequences in these strings implies a change in some of the values of the orc, orhi, orl, and orvi capabilities. Also, the distance moved when a wide character is printed, specified by the widcs capability, changes in relation to the orc value. The distance moved when a character is printed in micro mode, mcs, changes similarly, with one exception: if the distance is 0 or 1, then no change is assumed.

Programs that use the cpi, lpi, chr, or cvr capability should recalculate the printer resolution and should recalculate other values. For more information, see Effect of Changing Printing Resolution.

The figure Specification of Printer Resolution Effects of Changing the Character/Line Pitches shows the effects on printer resolution before and after a change.

Vcpi, Vlpi, Vchr, and Vcvr are the arguments used with cpi, lpi, chr, and cvr respectively. The dagger symbol indicates the old value.

Capabilities that Cause Movement

In the following descriptions, movement refers to the motion of the current position. With video terminals this would be the cursor; with some printers this is the carriage position. Other printers have different equivalents. In general, the current position is where a character would be displayed if printed.

The terminfo database has string capabilities for control sequences that cause movement a number of full columns or lines. It also has equivalent string capabilities for control sequences that cause movement a number of small steps. The following are the string capabilities for motion:

Capability Description
mcub1 Move 1 step left.
mcuf1 Move 1 step right.
mcuu1 Move 1 step up.
mcud1 Move 1 step down.
mcub Move N steps left.
mcuf Move N steps right.
mcuu Move N steps up.
mcud Move N steps down.
mhpa Move N steps from the left.
mvpa Move N steps from the top.

The last six strings are each used with a single N argument.

Sometimes the motion is limited to less than the width or length of a page. Also, some printers do not accept absolute motion to the left of the current position. The following capabilities limit motion:

Capability Description
mjump Limits the use of mcub1, mcuf1, mcuu1, and mcud1 capabilities.
maddr Limits the use of the mhpa and mvpa capabilities.
xhpa If set, the hpa and mhpa capabilities are negated.
xvpa If set, the vpa and mvpa capabilities are negated.

If a printer needs to be in micro mode for the motion capabilities to work, you can define a string capability to contain the control sequence to enter and exit micro mode. A boolean is available for those printers where using a carriage return causes an automatic return to normal mode. The following capabilities are related to micro mode behavior:

Capability Description
smicm Enter micro mode.
rmicm Exit micro mode.
crxm Using the key specified by the cr capability exits micro mode.

The movement made when a character is printed in the rightmost position varies among printers. Some make no movement, some move to the beginning of the next line, others move to the beginning of the same line. The terminfo database has boolean capabilities that description all three cases. The sam capability specifies that the printer automatically moves to the beginning of the same line after the character is printed in the rightmost margin.

Some printers can be put in a mode where the normal direction of motion is reversed. This mode is especially useful when there exists no capabilities for leftward or upward motion, you can build these capabilities from the motion reversal capability and the rightward or downward motion capabilities. It is best to leave it up to an application to build the leftward or upward capabilities, though, and not enter them into to the terminfo database. This allows several reverse motions to be strung together without intervening wasted steps that leave and reenter reverse mode. The following capabilities control entering and exiting reverse modes:

Capability Description
slm Reverse sense of horizontal motions.
rlm Restore sense of horizontal motions.
sum Reverse sense of vertical motions.
rum Restore sense of vertical motions.

The following capabilities affect the screen while the horizontal motions are reversed:

Capability Description
mcub1 Move 1 step right.
mcuf1 Move 1 step left.
mcub Move N steps right.
mcuf Move N steps left.
cub1 Move 1 column right.
cuf1 Move 1 column left.
cub Move N columns right.
cuf Move N columns left.

The following capabilities affect the screen whilethe vertical motions are reversed:

Capability Description
mcuu1 Move 1 step down.
mcud1 Move 1 step up.
mcuu Move N steps down.
mcud Move N steps up.
cuu1 Move 1 line down.
cud1 Move 1 line up
cuu Move N lines down.
cud Move N lines up.

The reverse motion mode should not affect the mvpa and mhpa absolute motion capabilities. The reverse vertical motion mode should, however, also reverse the action of the line wrapping that occurs when a character is printed in the right-most position. Thus printers that have the standard terminfo capability am defined should move to the beginning of the previous line when a character is printed on the right-most position and the printer is in reverse-vertical motion mode.

The action when any other motion capabilities are used in reverse motion modes is not defined. Thus, programs must exit reverse motion modes before using other motion capabilities.

Two miscellaneous capabilities complete the list of new motion capabilities, the docr and the zerom capability. The docr capability provides a list of control characters that cause a carriage return. This capability is useful for printers that move the current position to the beginning of a line when certain control characters, like line-feed or form-feed are used. The zerom capability prevents automatic motion after printing a single character. This capability suspends the motion that normally occurs after printing a character.

Margins

The terminfo database provides two strings for setting margins on terminals: one for the left and one for the right margin. Printers, however, have two additional margins for the top and bottom margins of each page. Furthermore, some printers do not require using motion strings to move the current position to a margin and fixing the margin there, as with existing capabilities, but require the specification of where a margin should be regardless of the current position. Therefore, the terminfo database offers six additional strings for defining margins with printers. The following capabilities affect margins:

Capability Definition
smgl Set left margin at the current column.
smgr Set right margin at the current column.
smgb Set the soft bottom margin at the current line.
smgt Set the soft top margin at the current line.
smgbp Set the soft bottom margin at line N.
smglp Set the soft left margin at column N.
smgrp Set the soft right margin at column N.
smgtp Set soft top margin at line N.

The last four strings are used with a single N parameter. This parameter specifies a line or column number, where 0 is the top line and column 0 is the left-most column.

Note: Not all printers use 0 for the top line or the left-most column.

All margins can be cleared with the mgc capability.

Shadows, Italics, Wide Characters, Superscripts, and Subscripts

Five new sets of strings are used to describe the capabilities that printers have of enhancing printed text. The following define enhanced printing capabilities:

Capability Definition
sshm Enter shadow-printing mode.
rshm Exit shadow-printing mode.
sitm Enter italicizing mode.
ritm Exit italicizing mode.
swidm Enter wide-character mode.
rwidm Exit wide-character mode.
ssupm Enter superscript mode.
rsupm Exit superscript mode.
supcs List of characters available as superscripts.
ssubm Enter subscript mode.
rsubm Exit subscript mode.
subcs List of characters available as subscripts.

If a printer requires the sshm control sequence before every character to be shadow-printed, the rshm string is left blank. Thus, programs that find a control sequence in sshm but none in shadow printing mode should use the control sequence specified by the sshm capability before every character to be shadow printed. Otherwise, the control sequence should be used once before the set of characters to be shadow-printed, followed by exiting shadow-printing mode.

The terminfo database also has a capability for printing emboldened text, the bold capability. While shadow printing and emboldened printing are similar in that they darken the text, many printers produce these two types of print in slightly different ways. Generally emboldened printing is done by overstriking the same character one or more times. Shadow printing likewise usually involves overstriking, but with a slight movement up and/or to the side so that the character is fatter.

It is assumed that enhanced printing modes are independent modes, so that it would be possible, for instance, to shadow print italicized subscripts.

As mentioned earlier, the amount of motion automatically made after printing a wide character should be given in the widcs capability.

If only a subset of the printable ASCII characters can be printed as superscripts or subscripts, they should be listed in the supcs or subcs capabilities, respectively. If the ssupm or ssubm strings contain control sequences, but the corresponding supcs or subcs strings are empty, it is assumed that all printable ASCII characters are available as superscripts or subscripts.

Automatic motion made after printing a superscript or subscript is assumed to be the same as for regular characters. For example, printing any of the following result in equivalent motion:

Bi Bi Bi

The boolean capability msgr describes whether an application can use motion control sequences while in standout mode. This capability is extended to cover the enhanced printing modes added here. The mgsr capability should be set for those printers that accept any motion control sequences without affecting shadow, italicized, widened, superscript, or subscript printing. Conversely, if the mgsr capability is not set, a program should end these modes before attempting any motion.

Alternate Character Sets

In addition to allowing you to define line graphics, the terminfo database also lets you define alternate character sets. The following capabilities cover printers and terminals with multiple selectable or definable character sets:

Capability Definition
scs Select character set N. The N parameter specifies a number from 0 to 63 that identifies a character set.
scsd Start definition of character set N, M characters. The N parameter specifies a number from 0 to 63 that identifies a character set and the M parameter specifies the number of characters in the set.
defc Defines a character A to be B dots wide with a descender D. The A parameter is the ASCII code representation for the character. The B parameter specifies the width of the character in dots. The D parameter specifies whether the character is a descender or not. If the character is a descender, specify a 1 for the D parameter. Otherwise, specify a 1. This string is followed by a string of image-data bytes that describe how the character looks.
rcsd End definition of character set N. The N parameter specifies a number from 0 to 63 that identifies a character set.
csnm List of character set names.
daisy Indicates the printer has manually changed print-wheels.

Character set 0 is the default character set. This is the set that is present after the printer is initialized. Not every printer supports 64 character sets. If you specify a set that a printer does not support, the tparm subroutine returns a null result.

If your application must define a character before using it, use the scsd control sequence before defining the character set, and the rcsd after. If you specify an invalid character set for either of these capabilities, the tparm subroutine returns a null resolution. If your application must select a character set after it is defined, the scs control sequence should follow the rcsd control sequence. By examining the results of using each of the scs, scsd, and rcsd strings with a character set number in a call to the tparm subroutine, a program can determine which of the three are needed.

Between use of the scsd and rcsd strings, the defc string should be used to define each character. To print any character on printers defined in the terminfo database, the ASCII cod is sent to the printer. This is true for characters in an alternate set as well as normal characters. Thus, the definition of a character includes the ASCII code that represents it. In addition, the width of the character includes the ASCII code that represents it. In addition, the width of the character in dots is given, along with tan indication of whether the character is a descender. A descender is a character whose shape extends below the baseline, for example the character g is a descender. The width of the character is dots also indicates the number of image-data bytes that will follow the defc string. These image-data bytes indicate where in a dot-matrix pattern ink should be applied to draw the character. The number of these bytes and their form are defined below under Dot-Mapped Graphics.

It is easiest for the creator of terminfo entries to refer to each character set by number. However, these numbers will be meaningless to the application developer. The csnm capability alleviates this problem by providing names for each number.

When used with a character set number in a call to the tparm subroutine, the csnm capability produces the equivalent name. Use these names as a references only. No naming convention is implied, although anyone who creates a terminfo entry for a printer should use names consistent with the names found in user documents for the printer. Application developers should allow a user to specify a character set by number (leaving it up to the user to examine the csnm string to determine the correct number), or by name, where the application examines the csnm capability to determine the corresponding character set number.

The alternate character set capabilities are likely to be used only with dot-matrix printers. If they are not available, do not define these strings. For printers that have manually changed print-wheels or font cartridges, set the boolean daisy capability.

Dot-Matrix Graphics

Dot-matrix printers typically have the capability to reproduce raster-graphics images. Three new numeric capabilities and three new string capabilities can help a program draw raster-graphic images independent of the type of dot-matrix printer or the number of pins or dots the printer can handle at one time. The dot-matrix capabilities are as follows:

Capability Definition
npins Number of pins N in the print-head. The N parameter specifies the number of pins.
spinv Spacing of pins vertically in pins per inch.
spinh Spacing of dots horizontally in dots per inch.
porder Matches software bits to print-head pins.
sbim Start printing bit image graphics, B bits wide. The B value specifies the width of the image in dots.
rbim End printing bit image graphics.

The model of dot-matrix or raster-graphics that the terminfo database presents is similar to the technique used for most dot-matrix printers. Each pass of the printer's print-head is assumed to produce a dot-matrix that is N dots high and B dots wide. This is typically a wide, squat, rectangle of dots. The height of this rectangle in dots varies from one printer to the next. This is given in the npins numeric capability. The size of the rectangle in fractions of an inch will also vary. The size can be deduced from the spinv and spinh numeric capabilities. With these three values an application can divide a complete raster-graphics image into several horizontal strips, perhaps interpolating to account for different dot spacing vertically and horizontally.

The sbim and rbim capabilities are used to start and end a dot-matrix image, respectively. The sbim capability is used with a single argument that gives the width of the dot-matrix in dots. A sequence of image-data bytes are sent to the printer after the sbim capability and before the rbim string. The number of bytes is an integral multiple of the width of the dot-matrix. The multiple and the form of each byte is determined by the porder capability is described below.

The porder capability is a comma-separated list of pin numbers. The position of each pin number in the list corresponds to a bit in a data byte. The pins are numbered consecutively from 1 to npins, with 1 being the top pin. The term pin is used loosely here. Ink-jet dot matrix printers don't have pins but they do have an equivalent method of applying a single dot of ink to paper. The bit positions in porder are in groups of 8, with the first position in each group the most significant bit and the last position the least significant bit.

The image-data bytes are computed from the dot-matrix image, mapping vertical dot positions in each print-head pass into eight-bit bytes, using a 1 bit where ink should be applied and 0 where no ink should be applied. If a position is skipped in porder, a 0 bit is used. There must be a multiple of 8 bit positions used or skipped in porder. If not, 0 bits are used to fill the last byte in the least significant bits.

Effect of Changing Printing Resolution

If the control sequences to change the character pitch or the line pitch are used, the pin or dot spacing may change. The following capabilities change pitch on dot-matrix graphics:

Capabilities Definition
cpi Change the character pitch.
cpix If set, cpi changes spinh.
lpi Change line pitch.
lpix If set, lpi changes spinv.

Programs that use cpi or lpi should recalculate the dot spacing. The figure Dot-Matrix Graphics Effects of Changing the Character/Line Pitches shows graphics both before and after a change in pitch.

The orhi' and orhi values are the values of the horizontal resolution in steps per inch, before using cpi and after using cpi, respectively. Likewise, orvi' and orvi are the values of the vertical resolution in steps per inch, before using lpi and after using lpi, respectively. Thus, the changes in the dots per inch for dot-matrix graphics follow the changes in steps per inch for printer resolution.

Print Quality

Many dot-matrix printers can alter the dot spacing of printed text to produce near letter-quality printing or draft-quality printing. Usually, it is important to be able to choose one or the other because the rate of printing generally falls off as the quality improves. The capabilities that specify print quality are the following:

Capability Definition
snlq Set near-letter quality print.
snrmq Set normal quality print.
sdrfq Set draft-quality print.

The capabilities are listed in decreasing levels of quality. If a printer does not have all three levels, one or two of the strings should be left blank as appropriate.

Printing Rate and Buffer Size

Because there is no standard protocol that synchronizes a printer with a program, and because modern printers can buffer data before printing it, a program generally cannot determine at any time what has printed. Two new numeric capabilities can help a program estimate what has printed, the cps and bufsz capabilities.

The cps capability specifies the nominal print rate in characters per second. The cps capability is the nominal or average rate at which the printer prints characters. If this value is not given, estimate the rate at one-tenth the prevailing baud rate.

The bufsz capability defines a terminal's buffer capacity in characters. The bufsz value is the maximum number of subsequent characters buffered before the guaranteed printing of an earlier character, assuming proper flow control was used. If this value is not given it is assumed that the printer does not buffer characters, but prints them as they are received.

As an example, if a printer has a 1000-character buffer, then sending the letter "a" followed by 1000 additional characters is guaranteed to cause the letter "a" to print. If the same printer prints at the rate of 100 characters per second, then it should take 10 seconds to print all the characters in the buffer, less if the buffer is not full. By keeping track of the characters sent to a printer, and knowing the print rate and buffer size, a program can synchronize itself with the printer.

Most printer manufacturers advertise the maximum print rate, not the nominal print rate. A good way to get a value to put in for cps is to generate a few pages of text, count the number of printable characters, then see how long it takes to print the text.

Applications that use these values should recognize the variability in the print rate. Straight text, in short lines, with no embedded control sequences will probably print at close to the advertised print rate and probably faster than the rate in cps. Graphics data with a lot of control sequences, or very long lines of text, will print at well below the advertised rate and below the rate in cps. If the application is using cps to decide how long it should take a printer to print a block of text, the application should pad the estimate. If the application is using cps to decide how much text has already been printed, it should shrink the estimate. The application errs in favor of the user, who wants, above all, to see all the output in its correct place.

Database File Names

Compiled terminfo file descriptions are placed in subdirectories under the /usr/share/lib/terminfo directory to avoid performing linear searches through a single directory containing all of the terminfo file description files. A given description file is stored in the /usr/share/lib/terminfo/c/name file, where name is the name of the terminal, and c is the first letter of the terminal name. For example, the compiled description for the terminal term4-nl can be found in the file /usr/share/lib/terminfo/t/term4-nl. You can create synonyms for the same terminal by making multiple links to the same compiled file. (See the ln command on how to create multiple links to a file.)

Example

The following terminfo entry describes a terminal:

hft|High Function Terminal,
    cr=^M, cud1=\E[B, ind=\E[S, bel=^G, il1=\E[L, am,
    cub1=^H, ed=\E[J, el=\E[K, clear=\E[H\E[J,
    cup=\E[%ip1%d;%p2%dH, cols#80, lines=#25,
    dch1=\E[P, dl1=\E[M, home=\E[H,
    ich=\E[%p1%d@, ich1=\E[@, smir=\E[6, rmir=\E6,
    bold=\E[1m, rev=\E[7m, blink=\E[5m, invis=\E[8m, sgr0=\E[0m,
    sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6t1;%;m,
    kcuu1=\E[A, kcud1=\E[B, kcub1=\E[D,
    kcuf1=\E[C, khome=\E[H, kbs=^H,
    cuf1=\E[C, ht=^I, cuu1=\E[A, xon,
    rmul1=\E[m, smul=\E[4m, rmso=\E[m, smso=\E[7m,
    kpp=\E[150q, knp=\E[154q,
    kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, kf4=\E[004q,
    kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q,
    kf9=\E[009q, kf10=\E[010q,
    bw, eo, it#8, ms,
    ch=\E%i%p1%dG, ech=\E[%p15dx,
    kdch1=\E[P, kind=\E[151q, kich1=\E[139q, kimr=\E[41,
    kn=^M, ko=^I, ktab=\E[Z, kri=\E[155q,
    cub=\E[%p1%dD, cuf=\E[%p1%dC, indn=\E[%p1dS, rin=\E[%p1%dT,
    ri=\E[T, cuu=\E[%p1%dA,
    box1=332\304\277\263\331\300\302\264\301\303\305,
    box2=311\315\273\272\274\310\313\271\312\314\316,
    batt2=md,
    colf0=\E[30m, colf1=\E[31m, colf2=\E[32m, colf3=\E[33m,
    colf4=\E[34m, colf5=\E[35m, colf6=\E[36m, colf7=\E[37m,
    colb0=\E[40m, colb1=\E[41m, colb2=\E[42m, colb3=\E[43m,
    colb4=\E[44m, colb5=\E[45m, colb6=\E[46m, colb7=\E[47m,

The following terminfo entry describes a terminal:

ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display,
        am,             mir,            cr=^M,          ind=^J,
        cols#80,        it#8,           lines#24,
kich1=\EP\040\010,
        ed=\EJ,         el=\EI,         cup=\EY%p1%' '%+%c%p2%'
'%+%c,
        clear=\EH\EJ,   dch1=\EQ,       dl1=\EO,        cud1=\EB,
        cub1=\ED,       blink=\E4D,     bold=\E4H,
sgr0=\E4@\E<@,
        invis=\E4P,     rev=\E4A,       cuf1=\EC,
rmso=\E4@,
        smso=\E4A,      rmul=\E4@,      cuu1=\EA,
smul=\E4B,
        sgr=\E4%'@'%?%p1%t%'A'%|%;
                   %?%p2%t%'B'%|%;
                   %?%p3%t%'A'%|%;
                   %?%p4%t%'D'%|%;
                   %?%p5%t%'@'%|%;
                   %?%p6%t%'H'%|%;
                   %?%p7%t%'P'%|%;%c
                   %?%p9%t\E>A%e\E<@%;,
        box1=\354\361\353\370\352\355\367\365\366\364\356,
        box2=\354\361\353\370\352\355\367\365\366\364\356,
batt2=md,
        ktbc=\E\0401,   kil1=\EN,       kbs=^H,
kclr=\EL^M,
        kcud1=\EB,      kdch1=\EQ,      kel=\EI,
khome=\EH,
        kcub1=\ED,      kdl1=\EO,       ktab=^I,        kcbt=\E2,
        kcuf1=\EC,      ked=\EJ,        kctab=\E1,      khts=\E0,
        kcuu1=\EA,      knl=\r,         kact=\E8\r,
        kf1=\Ea\r,      kf2=\Eb\r,      kf3=\Ec\r,
kf4=\Ed\r,
        kf5=\Ee\r,      kf6=\Ef\r,      kf7=\Eg\r,
kf8=\Eh\r,
        kf9=\Ei\r,      kf10=\Ej\r,     kf11=\Ek\r,
kf12=\El\r,
        kf13=\E!a\r,    kf14=\E!b\r,    kf15=\E!c\r,
kf16=\E!d\r,
        kf17=\E!e\r,    kf18=\E!f\r,    kf19=\E!g\r,
kf20=\E!h\r,
        kf21=\E!i\r,    kf22=\E!j\r,    kf23=\E!k\r,
kf24=\E!l\r,
        smcup=\E>A,     rmcup=\E>A,     msgr,
        home=\EH,       bel=^G, mc5=^P^R, mc4=^P^T,
    

Implementation Specifics

The terminfo database is part of Base Operating System (BOS) Runtime.

Files

/usr/share/lib/terminfo/?/* Compiled terminal capability database.

Related Information

The captoinfo command, infocmp command, tic command.

The printf, fprintf, or sprintf subroutine.

Curses Overview for Programming in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]