terminfo
Purpose
Describes terminals by capability.
Description
A terminfo file is a data base that describes terminals,
defining their capabilities and their methods of opera-
tion. It is used by various programs, including the
Extended Curses Library (libcur.a) and the vi editor.
The information defined includes initialization
sequences, padding requirements, cursor positioning, and
other command sequences that control specific terminals.
This section explains the terminfo source file format.
Before a terminfo source file can be used, it must be
compiled using the tic command, which is described in AIX
Operating System Commands Reference. You can edit and
modify these source files, such as
/usr/lib/terminfo/ibm.ti, which describes IBM terminals,
and /usr/lib/terminfo/dec.ti, which describes DEC termi-
nals.
See "TERM" for a list of some of the terminals supported
by predefined terminfo data base files and the corre-
sponding values for the TERM environment variable.
Each terminfo entry consists of a number of fields sepa-
rated by commas, ignoring any white space between commas.
The first field for each terminal gives the various names
the terminal is known separated by | (vertical bar) char-
acters. The first name given should be the most common
abbreviation for the terminal, the last name given should
be a long name fully identifying the terminal, and all
others are understood as synonyms for the terminal name.
All names except the last should be in lowercase and not
contain blanks. The last name can contain uppercase
characters for readability.
Terminal names (except the last) should be chosen using
the following conventions. A root name should be chosen
to represent the particular hardware class of the ter-
minal. This name should not contain hyphens, except to
avoid synonyms that conflict with other names. Possible
modes for the hardware or user preferences are indicated
by appending a - (hyphen) and an indicator of the mode to
the root name. Thus, a terminal in 132 column mode would
be term-w. The following suffixes should be used where
possible:
Suffix Meaning Example
-am With automatic margins (usually default) term-am
-c Color mode term-c
-w Wide mode (more than 80 columns) term-w
-nam Without automatic margins term-nam
-n Number of lines on the screen term-60
-na No arrow keys (leave them in local) term-na
-np Number of pages of memory term-4p
-rv Reverse video term-rv
Types of Capabilities
Capabilities in terminfo are of three types: boolean, numeric, and string.
Boolean capabilities indicate that the terminal has some particular feature.
Boolean capabilities are true if the corresponding name is in the terminal
description. Numeric capabilities give the size of the terminal or the size
of particular delays. String capabilities give a sequence that can be used
to perform particular terminal operations.
Entries can continue onto multiple lines by placing white space at the begin-
ning of each subsequent line. Comments are included on lines beginning with
the # (sharp sign) character.
List of Capabilities
The following table shows VARIABLE, which is the name the programmer uses to
access the terminfo capability. The CAP NAME (capability name) is the short
name used in the text of the data base, and is used by a person updating the
data base. The I. CODE is the 2-letter internal code used in the compiled
data base, and always corresponds to a termcap capability name.
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 source
file caps to be aligned. Whenever possible, names are chosen to be the same
as or similar to the ANSI X3.64 standard of 1979.
(P) Indicates that padding may be specified.
(G) Indicates that the string is passed through tparm with parameters as
given (#i).
(*) Indicates that padding may be based on the number of lines affected.
(#i) Indicates the i(th) parameter.
CAP I.
VARIABLE NAME CODE DESCRIPTION
Booleans:
auto_left_margin bw bw Indicates cub1 wraps
from column 0 to
last column.
CAP I.
VARIABLE NAME CODE DESCRIPTION
auto_right_margin am am Indicates terminal
has automatic
margins.
beehive_glitch xsb xs Indicates a terminal
with fl=escape and
f2=Ctrl-C.
ceol_standout_glitch xhp xs Indicates standout
not erased by over-
writing.
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, switch)
hard_copy hc hc Indicates hardcopy
terminal.
has_meta_key km km Indicates terminal
has a meta key
(shift, sets parity
bit).
has_status_line hs hs Indicates terminal
has extra "status
line."
insert_null_glitch in in Indicates insert
mode distinguishes
nulls.
memory_above da da Retains information
above display in
memory.
memory_below db db Retains information
below display in
memory.
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.
over_strike os os Indicates terminal
overstrikes.
status_line_esc_ok eslok es Indicates escape can
be used on the
status line.
teleray_glitch xt xt Indicates destruc-
tive tabs and blanks
inserted while
entering standout
mode.
tilde_glitch hz hz Indicates terminal
cannot print ~ char-
acters.
CAP I.
VARIABLE NAME CODE DESCRIPTION
transparent_underline ul ul Overstrikes with
underline character.
xon_xoff xon xo Indicates terminal
uses xon/xoff hand-
shaking.
Numbers:
columns cols co Specifies the number
of columns in a
line.
init_tabs it it Provides tabs ini-
tially every #
spaces.
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 vari-
able.
magic_cookie_glitch xmc sg Indicates number of
blank characters
left by smso or
rmso.
padding_baud_rate pb pb Indicates lowest
baud where carriage
return and line
return padding is
needed.
virtual_terminal vt vt Indicates virtual
terminal number.
width_status_lines wsl ws Specifies the number
of columns in status
line.
Strings:
appl_defined_str apstr za Application defined
terminal string.
back_tab cbt bt Back tab. (P)
bell bel bl Produces an audible
signal (bell). (P)
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. (P*)
CAP I.
VARIABLE NAME CODE DESCRIPTION
change_scroll_region csr cs Changes scroll
region to lines #1
through #2. (PG)
clear_all_tabs tbc ct Clears all tab
stops. (P)
clear_screen clear cl Clears screen and
puts cursor in home
position. (P*)
clr_eol el ce Clears to end of
line. (P)
clr_eos ed cd Clears to end of the
display. (P*)
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
white.
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
black.
column_address hpa ch Sets cursor column.
(PG)
command_character cmdch CC Indicates terminal
command prototype
character can be
set.
cursor_address cup cm Indicates screen
relative cursor
motion row #1 col
#2. (PG)
CAP I.
VARIABLE NAME CODE DESCRIPTION
cursor_down cud1 do Moves cursor down
one line.
cursor_home home ho Moves cursor to home
position (if no
cup).
cursor_invisible civis vi Makes cursor invis-
ible.
cursor_left cubl le Moves cursor left
one space.
cursor_mem_address mrcup CM Indicates memory
relative cursor
addressing.
cursor_normal cnorm ve Makes cursor appear
normal (undo vs or
vi).
cursor_right cuf1 nd Indicates nonde-
structive space
(cursor right).
cursor_to_ll ll ll Moves cursor to
first column of last
line (if no cup).
cursor_up cuu1 up Moves cursor up one
line (cursor up).
cursor_visible cvvis vs Makes cursor very
visible.
delete_character dch1 dc Deletes character.
(P*)
delete_line dl1 dl Deletes line. (P*)
dis_status_line dsl ds Disables status
line.
down_half_line hd hd Indicates subscript
(forward 1/2 line
feed).
enter_alt_charset_mode smacs as Starts alternate
character set. (P)
enter_blink_mode blink mb Enables blinking.
enter_bold_mode bold md Enables bold (extra
bright) mode.
enter_ca_mode smcup ti Begins programs that
use cup.
enter_delete_mode smdc dm Starts delete mode.
enter_dim_mode dim mh Enables half-bright
mode.
enter_insert_mode smir im Starts insert mode.
enter_protected_mode prot mp Enables protected
mode.
enter_reverse_mode rev mr Enables reverse
video mode.
enter_secure_mode invis mk Enables blank mode
(characters invis-
ible).
enter_standout_mode smso so Begins standout
mode.
CAP I.
VARIABLE NAME CODE DESCRIPTION
enter_underline_mode smul us Starts underscore
mode.
erase_chars ech ec Erases #1 charac-
ters. (PG)
exit_alt_charset_mode rmacs ae Ends alternate char-
acter set. (P)
exit_attribute_mode sgr0 me Disables all attri-
butes.
exit_ca_mode rmcup te Ends programs that
use cup.
exit_delete_mode rmdc ed Ends delete mode.
exit_insert_mode rmir ei Ends insert mode.
exit_standout_mode rmso se Ends stand out mode.
exit_underline_mode rmul ue Ends underscore
mode.
flash_screen flash vb Indicates visual
bell (may not move
cursor).
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 (hard-
copy terminal). (P*)
from_status_line fsl fs Returns from status
line.
init_1string is1 i1 Initializes ter-
minal.
init_2string is2 i2 Initializes ter-
minal.
init_3string is3 i3 Initializes ter-
minal.
init_file if if Identifies file con-
taining is.
insert_character ich1 ic Inserts character.
(P)
insert_line il1 al Adds new blank line.
(P*)
insert_padding ip ip Inserts pad after
character inserted.
(P*)
key_backspace kbs kb Sent by backspace
key.
key_back_tab kbtab k0 Sent by backtab key.
key_catab ktbc ka Sent by clear-all-
tabs key.
key_clear kclr kC Sent by clear-screen
or erase key.
key_ctab kctab kt Sent by clear-tab
key.
CAP I.
VARIABLE NAME CODE DESCRIPTION
key_command kcmd kc Command request key.
key_command_pane kcpn kW Command pane 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 kw End key.
key_eol ke1 kE Sent by clear-to-
end-of-line key.
key_eos ked kS Sent by clear-to-
end-of-screen key.
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 ka Sent by function key
F10.
key_f11 kf11 k< Sent by function key
F11.
key_f12 kf12 k> Sent by function key
F12.
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.
CAP I.
VARIABLE NAME CODE DESCRIPTION
key_newline knl kn New-line key.
key_next_pane knpn kv Next-pane key.
key_npage knp kN Sent by next-page
key.
key_ppage kpp kP Sent by previous-
page key.
key_prev_cmd kpcmd kp Sent by previous-
command key.
key_quit kquit kQ Quit key.
key_right kcuf1 kr Sent by terminal
right arrow key.
key_scroll_left kscl kz Scroll left.
key_scroll_right kscr kZ Scroll right.
key_select ksel kU Select key.
key_sf kind kF Sent by scroll-
forward/down key.
key_smap_in1 kmpf1 Kv Input for special
mapped key 1.
key_smap_out1 kmpt1 KV Output for mapped
key 1.
key_smap_in2 kmpf2 Kw Input for special
mapped key 2.
key_smap_out2 kmpt2 KW Output for mapped
key 2.
key_smap_in3 kmpf3 Kx Input for special
mapped key 3.
key_smap_out3 kmpt3 KX Output for mapped
key 3.
key_smap_in4 kmpf4 Ky Input for special
mapped key 4.
key_smap_out4 kmpt4 KY Output for mapped
key 4.
key_smap_in5 kmpf5 Kz Input for special
mapped key 5.
key_smap_out5 kmpt5 KZ Output for mapped
key 5.
key_sr kri kR Sent by scroll-
backward/up key.
key_stab khts kT Sent by set-tab key.
key_tab ktab ko Tab key.
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.
CAP I.
VARIABLE NAME CODE DESCRIPTION
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.
meta_on smm mm Enables "meta mode"
(8th bit).
meta_off rmm mo Disables "meta
mode."
newline nel nw Performs new-line
function (behaves
like CR followed by
LF).
pad_char pad pc Pads character
(instead of NUL).
parm_dch dch DC Deletes #1 charac-
ters. (PG*)
parm_delete_line dl DL Deletes #1 lines.
(PG*)
parm_down_cursor cud DO Moves cursor down #1
lines. (PG*)
parm_ich ich IC Inserts #1 blank
characters. (PG*)
parm_index indn SF Scrolls forward #1
lines. (PG)
parm_insert_line il AL Adds #1 new blank
lines. (PG*)
parm_left_cursor cub LE Moves cursor left #1
spaces. (PG)
parm_right_cursor cuf RI Moves cursor right
#1 spaces. (PG*)
parm_rindex rin SR Scrolls backward #1
lines. (PG)
parm_up_cursor cuu UP Moves cursor up #1
lines. (PG*)
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 xmit
string #2.
CAP I.
VARIABLE NAME CODE DESCRIPTION
print_screen mc0 ps Prints contents of
the screen.
prtr_off mc4 pf Disables the
printer.
prtr_on mc5 po Enables the printer.
repeat_char rep rp Repeats character #1
#2 times. (PG*)
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.
row_address vpa cv Positions cursor to
an absolute vertical
position (set row).
(PG)
save_cursor sc sc Saves cursor posi-
tion. (P)
scroll_forward ind sf Scrolls text up. (P)
scroll_reverse ri sr Scrolls text down.
(P)
set_attributes sgr sa Defines the video
attributes. (PG9)
set_tab hts st Sets a tab in all
rows, current
column.
set_window wind wi Indicates current
window is lines
#1-#2 cols #3-#4.
tab ht ta Tabs to next 8-space
hardware tab stop.
to_status_line tsl ts Moves to status
line, column #1.
underline_char uc uc Underscores one
character and moves
beyond it.
up_half_line hu hu Indicates super-
script (reverse 1/2
line-feed).
init_prog iprog iP Locates the program
for init.
key_a1 ka1 K1 Specifies upper left
of keypad.
key_a3 ka3 K3 Specifies upper
right of keypad.
key_b2 kb2 K2 Specifies center of
keypad.
CAP I.
VARIABLE NAME CODE DESCRIPTION
key_c1 kc1 K4 Specifies lower left
of keypad.
key_c3 kc3 K5 Specifies lower
right of keypad.
prtr_non mc5p pO Enables the printer
for #1 bytes.
Terminal capabilities have names. For instance, the fact that a terminal has
automatic margins (such as, an automatic new-line when the end of a line is
reached) is indicated by the capability am. Hence the description of the
terminal includes am. Numeric capabilities are followed by the # (sharp
sign) character and then the value. Thus the cols#80 capability, which indi-
cates the number of columns the terminal has, gives the value 80 for the ter-
minal.
Finally, string-valued capabilities, such as el (clear to end of line
sequence) are given by the 2-character code, an = (equal sign), and then a
string ending at the following , (comma). A delay in milliseconds may appear
anywhere in a string capability, enclosed between a $< and a > as in
"el=\EK$<3>", and padding characters are supplied by tputs to provide this
delay. The delay can be either a number, such as 20, or a number followed by
an * (asterisk), such as "3*". An asterisk indicates that the padding
required is proportional to the number of lines affected by the operation,
and the amount given is the per-affected-unit padding required. (In the case
of insert character, the factor is still the number of lines affected. This
is always 1, unless the terminal has xenl and the software uses it.) When an
asterisk is specified, it is sometimes useful to give a delay of the form
a.b, such as, 3.5, to specify a delay per unit to tenths of milliseconds.
(Only one decimal place is allowed.)
A number of escape sequences are provided in the string-valued capabilities
for easy encoding of characters there. Both \E and \e map to an Escape char-
acter, ^x maps to a Ctrl-x for any appropriate x, and the sequences \n, \l,
\r, \t, \b, \f, \s give a new-line, line-feed, return, tab, backspace, form-
feed, and space. Other escapes include \^ (backslash caret) for a ^ (caret),
\ \ (backslash backslash) for a \ (backslash), \, (backslash comma) for a ,
(comma), \: (backslash colon) for a : (colon), and \0 (backslash) for the
null character. (\0 will produce \200, which does not terminate a string but
behaves as a null character on most terminals.) Finally, characters can be
given as 3 octal digits after a \ (backslash).
Sometimes, individual capabilities must be commented out. To do this, put a
period before the capability name.
Preparing Descriptions
An effective way to prepare a terminal description is to imitate the
description of a similar terminal in the terminfo file and add to the
description gradually, using partial descriptions with vi to check that they
are correct. Be aware that a very unusual terminal may expose deficiencies
in the ability of this file to describe it or bugs in vi. To test a new ter-
minal description, set the environment variable TERMINFO to a path name of a
directory containing the compiled description you are working on and programs
will look there rather than in /usr/lib/terminfo. A test to get the correct
padding (if not known) is to edit the /etc/passwd file at 9600 baud, delete
about 16 lines from the middle of the screen, then hit the u key several
times quickly. If the terminal fails to display the result properly, more
padding is usually needed. A similar test can be used for insert character.
Basic Capabilities
The following describe basic terminal 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, cuu1, and cud1
Moves the cursor to the right, up, and down, respectively.
hc Specifies a printing terminal. The os capability should also be
specified.
lines Specifies the number of lines on a cathode ray tube (CRT) terminal.
os Indicates that when a character is displayed or printed in a posi-
tion already occupied by another character, the terminal over-
strikes the existing character, rather than replacing it with the
new character. os applies to storage scope, printing, and APL ter-
minals.
The terminfo initialization subroutine, setupterm, calls termdef to determine
the number of lines and columns on the display. If termdef cannot supply
this information, then setupterm uses the lines and cols values in the data
base.
A point to note here is that the local cursor motions encoded in terminfo are
undefined at the left and top edges of a CRT terminal. Programs should never
attempt to backspace around the left edge, unless bw is given, and never
attempt to go up locally off the top. In order to scroll text up, a program
should go to the bottom left corner of the screen and send the ind (index)
string.
To scroll text down, a program goes to the top left corner of the screen and
sends the ri (reverse index) string. The strings ind and ri are undefined
when not on their respective corners of the screen.
The am capability tells whether the cursor sticks at the right edge of the
screen when text is output, but this does not necessarily apply to a cuf1
from the last column. The only local motion that is defined from the left
edge is if bw is given, then a cub1 from the left edge will move to the right
edge of the previous row. If bw is not given, the effect is undefined. This
is useful for drawing a box around the edge of the screen, for example. If
the terminal has switch-selectable automatic margins, the terminfo file
usually assumes that it is on by specifying am. If the terminal has a
command that moves to the first column of the next line, that command can be
given as nel (new-line). It does not matter if the command clears the
remainder of the current line, so if the terminal has no cr and lf, it may
still be possible to craft a working nel out of one or both of them.
These capabilities suffice to describe printing terminals and simple CRT ter-
minals. 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,
And 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 in the terminal are
described by a parameterized string capability, with escapes similar to
printf %x in it. For example, to address the cursor, the cup capability is
given using two parameters: the row and column to address to. (Rows and
columns are numbered starting with 0 and refer to the physical screen visible
to the user, not to any unseen memory.) If the terminal has memory relative
cursor addressing, that can be indicated by mrcup.
The parameterized capabilities and their descriptions are:
cub1 Backspaces the cursor one space.
cup Addresses the cursor using two parameters: the row and column to
address. Rows and columns are numbered starting with 0 and refer
to the physical screen visible to the user, not to memory.
cuu1 Moves the cursor up one line on the screen.
hpa and vpa
Indicates the cursor has row or column absolute cursor addressing,
horizontal position absolute (hpa) and vertical position absolute
(vpa).
Sometimes the hpa and vpa capabilities are shorter than the more
general two parameter sequence and can be used in preference to
cup. If there are parameterized local motions (such as, move n
spaces to the right) these can be given as cud, cub, cuf, and cuu
with a single parameter indicating how many spaces to move. These
are primarily useful if the terminal does not have cup.
indn and rin
Scrolls text. These are parameterized versions of the basic capa-
bilities ind and ri. n is the number of lines.
mrcup Indicates the terminal has memory-relative cursor addressing.
The parameter mechanism uses a stack and special % codes to manipulate it.
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).
"%"d Print pop() as in printf (numeric string from stack).
"%"2d Print pop() like "%"2d (minimum 2 digits output from stack).
"%"3d Print pop() like "%"3d (minimum 3 digits output from stack).
"%"02d Prints as in printf (2 digits output).
"%"03d Prints as in printf (3 digits output).
"%"c Print pop() gives "%"c (character output from stack).
"%"s Print pop() gives "%"s (string output from stack).
"%"p[i] Pushes the i(th) parameter onto stack.
"%"P[a-z] Sets variable [a-z] to pop() (variable ouptput from stack).
"%"g[a-z] Gets variable [a-z] and pushes it onto the stack.
"%"'c' Character constant c.
"%"{nn} Integer constant nn.
"%+ %- %* %/ %m"
Arithmetic ("%"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:
"%"? c[1] "%"t b[1] "%"e c[2] "%"t b[2] "%"e c[3] "%"t b[3] "%"e b[4] "%";
In this example, c[i] denote conditions, and b[i] denote
bodies.
Binary operations are in postfix form with the operands in the usual order.
That is, to get "x - 5" one would use "%gx%{5}%-".
Consider a terminal, which, to get to row 3 and column 12, needs to be sent
"\E&a12c03Y" padded for 6 milliseconds. Note that the order of the rows and
columns is inverted here, and that the row and column are printed as two
digits. Thus its cup capability is "cup=6\E&a%p2%2dc%p1%2dY".
Some terminals need the current row and column sent preceded by a ^T with the
row and column simply encoded in binary, "cup=^T%p1%c%p2%c". Terminals which
use %c need to be able to backspace the cursor (cub1), and to move the cursor
up one line on the screen (cuu1). This is necessary because it is not always
safe to transmit \n, ^D, and \r, as the system may change or discard them.
(The library routines dealing with terminfo set terminal modes so that tabs
are not expanded by the operating system; thus \t is safe to send.)
A final example is a terminal that uses row and column offset by a blank
character, thus "cup=\E=%p1%' '%+%c%p2%' '%+%c". After sending "\E=", this
pushes the first parameter, pushes the ASCII value for a space (32), adds
them (pushing the sum on the stack in place of the two previous values) and
outputs that value as a character. Then the same is done for the second
parameter. More complex arithmetic is possible using the stack.
Cursor Motions
If the terminal has a fast way to home the cursor (to very upper left corner
of screen) then this can be given as home. Similarly a fast way of getting
to the lower left-hand corner can be given as ll; this may involve going up
with cuu1 from the home position, but a program should never do this itself
(unless ll does) because it can make no assumption about the effect of moving
up from the home position. Note that the home position is the same as
addressing (0,0) to the top left corner of the screen, not of memory. (Thus,
the \EH sequence on some terminals cannot be used for home.)
Area Clears
The following areas are used to 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 postion to the end of the line
without moving the cursor.
Insert/Delete Line
The following describes the insert and delete line capabilities:
csr Indicates the terminal has a scrolling region that can be set.
This capability takes two parameters: the top and bottom lines of
the scrolling region.
da Indicates the terminal can retain display memory above what is
visible.
db Indicates the display memory can be retained below what is visible.
dl1 Indicates the line the cursor is on can be deleted. This 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 Creates a new blank line before the line where the cursor is cur-
rently 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.
rc Restores the cursor. When used after the csr capability, it gives
an effect similar to delete line.
sc Saves the cursor. When used after the csr capability, it gives an
effect similar to insert line.
wind Indicates the terminal has the ability to define a window as part
of memory. This a parameterized string with 4 parameters: the
starting and ending lines tn memory and the stating and ending
columns in memory, in that order.
Insert/Delete Character
Generally, there are two kinds of programmable terminals with respect to
insert/delete character operations which can be described using the terminfo
file. 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 distinction between typed and untyped blanks on
the screen, shifting data displayed to insert or delete at a position on the
screen occupied by an untyped blank, which is either eliminated or expanded
to two untyped blanks. Clearing the screen and then typing text separated by
cursor motions differentiates between the terminal types. You can determine
the kind of terminal you have by doing the following:
1. Type abc def using local cursor movements, not spaces, between the abc
and the def.
2. Position the cursor before the abc and place the terminal in insert mode.
If typing characters causes the characters on the line to the right of
the cursor to shift 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.
While these are two logically separate attributes (one line vs. multiline
insert mode, and special treatment of untyped spaces) there are no known ter-
minals whose insert mode cannot be described with the single attribute.
The terminfo file can describe both terminals having an insert mode and ter-
minals that send a simple sequence to open a blank position on the current
line. The following are used to describe insert or delete character capabili-
ties:
dch1 Deletes a single character. dch with one parameter, n deletes n
characters.
ech Erases n characters (equivalent to typing n blanks without moving
the cursor) with one parameter.
ich1 Precedes the character to be inserted. Most terminals with an
insert mode do not use this. Terminals that send a sequence to
open a screen position should give it. (If the terminal has both,
insert mode is usually preferable to ich1. Do not give both unless
the terminal actually requires both to be used in combination.)
ip Indicates post padding needed. This is given as a number of milli-
seconds. Any other sequence that may need to be sent after
inserting a single character can be given in this capability.
mir Allows cursor motion while in insert mode. It is sometimes neces-
sary 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.
smdc Enters delete mode.
smir Begins insert mode.
Note that if your terminal needs both to be placed into an insert mode and a
special code to precede each inserted character, then both smir/rmir and
ich1 can be given, and both will be used. The ich capability, with one
parameter, n, will repeat the effects of ich1 n times.
Highlighting, Underlining, and Visual Bells
If your terminal has one or more kinds of display attributes such as high-
lighting, underlining, and visual bells, these can be presented in a number
of ways. Highlighting, such as standout mode, presents a good, high con-
trast, easy-on-the-eyes format to add emphasis to error messages, and other
attention getters. Underlining is another method to focus attention to a
particular portion of the terminal. Visual bells include methods such as
flashing the screen. The following capabilities describe highlighting,
underlining, and visual bells for a terminal:
blink Indicates terminal has blink highlighting mode.
bold Indicates terminal has extra bright highlighting mode.
civis Causes the cursor to be invisible.
cnorm Causes the cursor to display normal. This capability reverses the
effects of the civis and cvvis capabilities.
cvvis Causes the cursor to be more visible than normal when it is not on
the bottom line.
dim Indicates the terminal has half-bright highlighting modes.
eo Indicates blanks erase overstrikes.
flash Indicates the terminal has a way of flashing the screen (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 while in standout mode.
Otherwise, programs using standout mode should exit standout mode
before moving the cursor or sending a new-line. Some terminals
automatically leave standout mode when they move to a new line or
the cursor is addressed.
prot Indicates the terminal has protected highlighting mode.
rev Indicates the terminal has reverse video mode.
rmso Exits standout mode.
rmul Ends underlining.
sgr Sets attributes. sgr0 turns off all attributes. Otherwise, if the
terminal allows a sequence to set arbitrary combinations of modes,
sgr takes 9 parameters. Each parameter is either 0 or 1, as the
corresponding attribute is on or off. The 9 parameters are in this
order: standout, underline, reverse, blink, dim, bold, blank,
protect, and alternate character set. (sgr can only support those
modes for which separate attributes exist on a particular ter-
minal.)
smcup and rmcup
Indicates the terminal needs to be in a special mode when running a
program that uses any of the highlighting, underlining or visual
bell capabilities. smcup enters this mode, while rmcup exits this
mode. This need arises, for example, from terminals with 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 where smcup sets
the command character to be used by the terminfo 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.
Keypad
If the terminal has a keypad that transmits codes when the keys are pressed,
this information can be given. Note that it is not possible to handle termi-
nals 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. The codes sent by the left arrow,
right arrow, up arrow, down arrow, and home keys can be given as kcub1,
kcuf1, kcuu1, kcud1, and khome, respectively. If there are function keys
such as F0, F1, . . . , F10, the codes they send can be given as kf0, kf1, .
. . , kf10. If these keys have labels other than the default F0 through F10,
the labels can be given as lf0, lf1, . . . , lf10. The codes transmitted by
certain other special keys can be given as:
kbs Indicates the backspace key.
kclr Indicates the clear screen or erase key.
kctab Indicates clear the tab stop in this column.
kdch1 Indicates the delete character key.
kdl1 Indicates the delete line key.
ked Indicates clear to end of screen.
kel Indicates clear to end of line.
khts Indicates set a tab stop in this column.
kich1 Indicates insert character or enter insert mode.
kil1 Indicates insert line.
kind Indicates scroll forward and/or down.
kll Indicates home down key (home is the lower left corner of the
display, in this instance).
kmir Indicates exit insert mode.
knp Indicates next page.
kpp Indicates previous page.
ktbc Indicates the clear all tabs key.
ri Indicates scroll backward and/or up.
In addition, if the keypad has a 3-by-3 array of keys including the 4 arrow
keys, the other 5 keys can be given as ka1, ka3, kb2, kc1, and kc3. These
keys are useful when the effects of a 3-by-3 directional pad are needed.
Tabs and Initialization
If the terminal has hardware tabs, the command to advance to the next tab
stop can be given as ht (usually Ctrl-I). A "backtab" command which moves
left toward the previous tab stop can be given as cbt. By convention, if the
terminal modes indicate that tabs are being expanded by the operating system
rather than being sent to the terminal, programs should not use ht or cbt
even if they are present, since the user may not have the tab stops properly
set. If the terminal has hardware tabs that are initially set every n spaces
when the terminal is powered up, the numeric parameter it is given, showing
the number of spaces the tabs are set to. This is normally used by the tset
command 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 capabilities include is1, is2, and is3, initialization strings for the
terminal, iprog, the path name of a program to be run to initialize the ter-
minal, and if, the name of a file containing long initialization strings.
These strings are expected to set the terminal into modes consistent with the
rest of the terminfo description. They are normally sent to the terminal, by
the tset program, each time the user logs in. They are printed in the fol-
lowing order: is1, is2, setting tabs using tbc and hts; if; running the
program iprog; and finally is3. Most initialization is done with is2.
Special terminal modes can be set up without duplicating strings by putting
the common sequences in is2 and special cases in is1 and is3. A pair of
sequences that does a harder reset from a totally unknown state can be
analogously given as rs1, rs2, rf, and rs3, analogous to is2 and if. These
strings are output by the reset program, which is used when the terminal
starts behaving strangely, or not responding at all. Commands are normally
placed in rs2 and rf only if they produce annoying effects on the screen and
are not necessary when logging in. For example, the command to set the ter-
minal into 80-column mode would normally be part of is2, but it causes an
annoying screen behavior and is not normally needed since the terminal is
usually already in 80-column mode.
If there are commands to set and clear tab stops, they can be given as tbc
(clear all tab stops) and hts (set a tab stop in the current column of every
row). If a more complex sequence is needed to set the tabs than can be
described by this, the sequence can be placed in is2 or if.
Certain capabilities control padding in the terminal driver. These are pri-
marily needed by hard copy terminals, and are used by the tset program to set
terminal modes appropriately. Delays embedded in the capabilities cr, ind,
cub1, ff, and tab cause the appropriate delay bits to be set in the terminal
driver. If pb (padding baud rate) is given, these values can be ignored at
baud rates below the value of pb.
Miscellaneous Strings
If the terminal requires other than a null (zero) character as a pad, then
this can be given as pad. Only the first character of the pad string is
used.
If the terminal has an extra "status line" that is not normally used by soft-
ware, this fact can be indicated. If the status line is viewed as an extra
line below the bottom line, into which one can cursor address normally, the
capability hs 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 tsl and fsl.
(fsl must leave the cursor position in the same place it was before tsl. If
necessary, the sc and rc strings can be included in tsl and fsl to get this
effect.) The parameter tsl takes one parameter, which is the column number
of the status line the cursor is to be moved to. If escape sequences and
other special commands, such as tab, work while in the status line, the flag
eslok can be given. A string 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. 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 numeric parameter wsl.
If the terminal can move up or down half a line, this can be indicated with
hu (half-line up) and hd (half-line down). This is primarily useful for
superscripts and subscripts on hardcopy terminals. If a hardcopy terminal
can eject to the next page (form-feed), give this as ff (usually Ctrl-L).
If there is a command to repeat a given character a given number of times (to
save time transmitting a large number of identical characters) this can be
indicated with the parameterized string rep. The first parameter is the
character to be repeated and the second is the number of times to repeat it.
Thus, "tparm(repeat_char,'x',10)" is the same as "xxxxxxxxxx".
If the terminal has a "meta key" which acts as a shift key, setting the
eighth bit of any character transmitted, this fact can be indicated with km.
Otherwise, software will assume 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 smm and rmm.
If the terminal has more lines of memory than will fit on the screen at once,
the number of lines of memory can be indicated with lm. A value of lm#0
indicates that the number of lines is not fixed, but that there is still more
memory than fits on the screen.
Media copy strings that control an auxiliary printer connected to the ter-
minal can be given in the following ways: 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. A variation mc5p takes one parameter, and leaves the printer
on for as many characters as the value of the parameter, then turns the
printer off. The parameter should not exceed 255. All text, including mc4,
is transparently passed to the printer while an mc5p is in effect.
Strings to program function keys can be given as pfkey, pfloc, and pfx. Each
of these strings takes two parameters: the function key number to program
(from 0 to 10) and the string to program it with. Function key numbers out
of this range can program undefined keys in a terminal-dependent manner. The
difference between the capabilities is that pfkey causes pressing the given
key to be the same as the user typing the given string; pfloc causes the
string to be executed by the terminal in local mode; and pfx causes the
string to be transmitted to the computer.
Indicating Terminal Problems
Terminals that do not allow ~ (tilde) characters to be displayed should indi-
cate hz.
Terminals that ignore a line-feed character immediately after an am wrap
should indicate xenl.
If el is required to get rid of standout (instead of merely writing normal
text on top of it), xhp should be given.
Terminals for which tabs turn all characters moved to blanks should indicate
xt (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.
The terminal that is unable to correctly transmit the ESC (escape) or Ctrl-C
characters has xsb, indicating that the F1 key is used for ESC and F2 for
Ctrl-C.
Other specific terminal problems can be corrected by adding more capabilities
of the form xx.
Similar Terminals
If two terminals are very similar, one can be defined as being just like the
other with certain exceptions. The string capability use can be given with
the name of the similar terminal. The capabilities given before use override
those in the terminal type invoked by use. A capability can be cancelled by
placing xx@ to the left of the capability definition, where xx is the capa-
bility. For example, the entry:
term-nl, smkx@, rmkx@, use=term,
defines a terminal that does not have the smkx or rmkx capabilities, and
hence does not turn on the function key labels when in visual mode. This is
useful for different modes for a terminal, or for different user preferences.
Data Base File Names
Compiled terminfo descriptions are placed in subdirectories under
/usr/lib/terminfo in order to avoid performing linear searches through a
single directory containing all of the terminfo description files. A given
description file is stored in /usr/lib/terminfo/c/name, 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/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 in AIX Operating System Commands Reference on how to create multiple
links to a file.)
Example
The following entry, which describes a terminal, is among the entries in the
terminfo file.
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;%;%?%p6%t1;%;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,
rmul=\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, krmir \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,
Files
/usr/lib/terminfo/?/* Compiled terminal capability data base.
Related Information
In this book: "curses," "Terminfo Level Subroutines," "extended curses
library," "printf, fprintf, sprintf, NLprintf, NLfprintf, NLsprintf,"
"termdef," and "TERM."
The display and tic commands in AIX Operating System Commands Reference.