COHERENT manpages

This page displays the COHERENT manpage for terminfo [Terminal-description language].

List of available manpages
Index


terminfo -- System Administration

Terminal-description language
/usr/lib/terminfo

terminfo is a  system for describing terminals.  Descriptions are collected
in the file  /usr/lib/terminfo and are read by curses,  more, vi, and other
utilities.  By  passing her terminal's terminfo entry to  a program, a user
can make  sure that the program  can take full advantage  of her terminal's
capacities.

terminfo resembles  the terminal-description language  termcap; however, it
enjoys a number of features that termcap does not, as follows:

-> A termcap  entry cannot exceed a predefined  limit.  terminfo lifts this
   restriction.

-> terminfo entries are compiled;  therefore, they are read and loaded more
   quickly.

-> termcap entries are all kept in file /etc/termcap. Each terminfo resides
   in  its own  file;  thus, a  program  and find  and load  an entry  more
   quickly.

-> terminfo is a little more easily read by human beings.

Whether a program uses termcap or terminfo descriptions depends entirely on
that program.   For example, MicroEMACS uses  termcap descriptions; but vsh
(and  other curses-based  programs) use terminfo.  In general,  terminfo is
regarded as being more flexible and up-to-date.

terminfo Entries

Directory /usr/lib/terminfo  consists of  a number of  sub-directories, one
for each terminal type being  described.  A terminal type describes a given
make of terminal (e.g., the Wyse  150) plus some special attribute, such as
the number of characters on a  line or a specially defined bank of function
keys.  A  terminfo entry can  extend over more  than one line  by indenting
every line after the first.  A  line that begins with a pound sign `#' is a
comment.

A  terminfo  entry  consists of  an  indefinite  number of  comma-separated
fields.  White  space after each  comma is ignored.  The  first field names
the  terminal; the  remaining  fields hold  capability codes.   (Capability
codes are discussed  in detail below.) Preceding a field  with a period `.'
comments out that field, and only that field.

Naming Terminals

The first  field in  a terminfo entry  names the terminal  being described.
The  name field  consists of  one  or more  names, which  are separated  by
vertical-bar  characters.   The   first  name  given  is  the  most  common
abbreviation for the  terminal.  The last name is usually  a long name that
fully identifies the terminal.  All names in between the first and the last
give common  synonyms for that terminal.  All  names can contain upper-case
characters; the last name can also contain white space.

Terminal  names  (except  for  the  last,  verbose entry)  should  use  the
following conventions:

-> The hardware should have a root name chosen, e.g., ``wyse150''.

-> The root  name should  not contain  hyphens, except to  prevent synonyms
   from colliding with other names.

-> Modes  that the  hardware  can be  in,  or user  preferences, should  be
   indicated  by appending  a hyphen  and  an indicator  of the  mode.  For
   example, a wyse150 with an old-fashioned 82-key keyboard could be called
   wyse150-o.

Use the following suffixes whenever possible:

Suffix    Meaning
-w        Wide (more than 80 columns)
-am       With automatic margins (usually default)
-nam      Without automatic margins
-n        Number of lines on the screen
-na       No arrow keys
-np       n pages of memory
-rv       Reverse video

Capability Codes

A capability  code describes a capability of  a terminal.  Capability codes
come in three varieties:

Boolean   This indicates  whether a terminal  has a given  feature.  If the
          field is present, the terminal is assumed to have the capability;
          if not, then  it is assumed not to be  present.  For example, the
          code  am indicates  ``automatic margins''.   If  am appears  in a
          terminal's terminfo entry, then it can execute automatic margins;
          if not, then it can't.

Numeric   This gives  the size of  some aspect of  a terminal, such  as the
          number  of lines  or the  number of columns.   A numeric  code is
          followed by a number sign `#'  and then a string of digits, which
          set  the  value  for that  code  For  example,  the code  cols#80
          indicates that a terminal has 80 columns per row.

String Capabilities
          This  gives a  sequence  of characters  that  trigger a  terminal
          operation.   For  example,   a  terminal  may  expect  a  ``magic
          sequence'' to  wipe the screen clean, to  print in reverse video,
          or to  change the shape of its cursor.   Likewise, a terminal may
          send  a ``magic  sequence''  when a  particular  function key  is
          pressed.   For example,  the  code klf1=\E5  indicates that  this
          terminal  sends the  string  <esc>5 when  the user  presses
          function-key 1.

Some  terminal capabilities  may involve  padding --  that is,  telling the
terminal to delay  execution of the capability for a  fraction of a second.
In some  instances, padding  may make  the difference between  a terminal's
drawing information correctly, or displaying a jumble.

A  delay code  can appear  anywhere  in a  string capability  code.  It  is
introduced by a dollar sign `$' and enclosed in angle brackets `<>'.
The  numeric  value  is always  in  milliseconds.   For  example, the  code
el=\EK$<3> indicates that the clear-to-end-of-line code el is invoked
by the ``magic sequence'' <esc>K, and that it should involve a three-
millisecond delay.  Function tputs() provides the delay.

The delay can be either a  number, e.g., ``20'', or a number followed by an
asterisk, e.g.,  ``3*''.  An  asterisk indicates  that the padding  must be
proportional to  the number of lines affected by  the operation; the amount
given is the  amount of padding required by each  line of output.  (This is
true even  in the case of  the insert-character code.) When  an asterisk is
specified, it  is sometimes useful to  give a delay of  the form ``3.5'' to
specify  a delay-per-unit  to tenths  of  milliseconds.  (Only  one decimal
place is allowed.)

The  following table  gives the commonest  terminfo capability  codes.  The
variable  is the  name  by which  the  programmer (at  the terminfo  level)
accesses the capability.  The code is  the name used in the terminfo entry.
There is no  fixed limit to the length of  a code, but the convention is to
keep them  to five characters  or fewer.  Whenever possible,  names are the
same as, or similar to, those in the ANSI Standard X3.64-1979.

The semantics describe features of the code:

+  You may specify padding.

+* Padding may be based on the number of lines affected.

#  The string is passed through tparm() with the number of parameters given
   in the description.

#i Indicate the ith parameter.


Boolean Codes


Code    Variable                 Description
am..... auto_right_margin....... Automatic margins
bce.... back_color_erase........ Erase screen with background color
bw..... auto_left_margin........ cub1 wraps from column 0 to last column
ccc.... can_change.............. Terminal can redefine a color
chts... hard_cursor............. Cursor is difficult to see
cpix... cpi_changes_res......... Changing character pitch also changes resolution
crxm... cr_cancels_micro_mode... Carriage return cancels micro mode
da..... memory_above............ Display can be retained above the screen
daisy.. has_print_wheel......... You must change print wheel on printer
db..... memory_below............ Display can be retained below the screen
eo..... erase_overstrike........ Erase overstrikes with a blank
eslok.. status_line_esc_ok...... Escape can be used on the status line
gn..... generic_type............ Generic line type (e.g., dialup, switch).
hc..... hard_copy............... Hardcopy terminal
hls.... hue_lightness_saturation Terminal uses HLS color notation
hs..... has_status_line......... Has an extra ``status line''
hz..... tilde_glitch............ Hazeltine cannot print tildes `~'
in..... insert_null_glitch...... Insert mode distinguishes NULs
km..... has_meta_key............ Has a metakey (shift sets parity bit)
mc5i... prtr_silent............. Printer does not echo on screen
mir.... move_insert_mode........ Safe to move while in insert mode
msgr... move_standout_mode...... Safe to move in standout modes
npc.... no_pad_char............. No padding character
nxon... needs_xon_xoff.......... Padding does not work:  needs XON/XOFF
os..... over_strike............. Terminal overstrikes
sam.... semi_auto_right_margin.. Printing in last column returns carriage
ul..... transparent_underline... Underline character overstrikes
xenl... eat_newline_glitch...... Newline ignored after 80 columns (Concept)
xhp.... ceol_standout_glitch.... Standout not erased by overwriting (HP)
xhpa... col_addr_glitch......... Only positive motion for HPA/MHPA capitals
xon.... xon_xoff................ Terminal uses XON/XOFF handshaking
xsb.... no_esc_ctlc............. Beehive terminal (F1=escape, F2=<ctrl-C>)
xvpa... row_addr_glitch......... Only positive motion for VPA/MVPA capitals
xt..... teleray_glitch.......... Tabs destructive, magic SO char (Teleray 1061)

Numeric Codes


Code    Variable                 Description
bufsz.. buffer_capacity......... Number of bytes buffered before printing
colors. max_colors.............. Maximum number of colors on the screen
cols... columns................. Number of columns in a line
it..... init_tabs............... Tabs initially every n spaces
lines.. lines................... Number of lines on screen or page
lm..... lines_of_memory......... Lines of memory if greater than lines; zero, variable
maddr.. max_micro_address....... Maximum value in micro_ ... _address
mjump.. max_micro_jump.......... Maximum value in parm_ ... _micro
mls.... micro_line_size......... Line-step size when in micro mode
ncv.... no_color_video.......... Video attributes that cannot be used with color
nlab... num_labels.............. Number of labels on the screen
npins.. number_of_pins.......... Number of pins in the print-head
orc.... output_res_char......... Horizontal resolution, units per character
orhi... output_res_horz......... Horizontal resolution in units per inch
orl.... output_res_line......... Vertical resolution, units per line
orvi... output_res_vert......... Vertical resolution, units per inch
pairs.. max_pairs............... Maximum number of color_pairs on screen
pb..... padding_baud_rate....... Lowest baud rate where CR/NL padding is needed
spinh.. dot_horz_spacing........ Spacing of pins horizontally (pins/inch)
spinv.. dot_vert_spacing........ Spacing of pins vertically (pins/inch)
vt..... virtual_terminal........ Virtual terminal number
widcs.. wide_char_size.......... Character step size, double-width mode
wsl.... width_status_line....... Number of columns in the status line
xmc.... magic_cookie_glitch..... Number of blank characters left by smso or rmso

String Capabilities


Code    Variable                 Description
CC..... command_character....... Terminal-settable command character in prototype
acsc... acs_chars............... Pairs of graphical character set (aAbBcC ...)
bel.... bell.................... Audible signal (bell)+
blink.. enter_blink_mode........ Turn on blinking
bold... enter_bold_mode......... Turn on bold (extra bright)
cbt.... back_tab................ Back tab+
ch..... erase_charse............ Erase #1 characters+#
chr.... change_res_horz......... Change horizontal resolution
civis.. cursor_invisible........ Make cursor invisible
clear.. clear_screen............ Clear screen+*
cnorm.. cursor_normal........... Make cursor appear normal (undo vs and vi)
cpi.... change_char_pitch....... Change number of characters per inch
cr..... carriage_return......... Carriage return+*
csnm... char_set_names.......... Names of character sets
csr.... change_scroll_region.... change to lines #1 through #2 (vt100)+#
cub.... parm_left_cursor........ Move cursor left #1 spaces+#
cub1... cursor_left............. Move cursor left one space
cud.... parm_down_cursor........ Move cursor down #1 lines.+*#
cud1... cursor_down............. Move cursor down one line
cuf.... parm_right_cursor....... Move cursor right #1 spaces+*#
cuf1... cursor_right............ Move cursor right one space
cup.... cursor_address.......... Cursor motion relative to row 1 column 2+#
cuu.... parm_up_cursor.......... Move cursor up #1 lines+*#
cuu1... cursor_up............... Upline (cursor up)
cvr.... change_rs_vert.......... Change vertical resolution
cvvis.. cursor_visible.......... Make cursor very visible
dch.... parm_dch................ Delete #1 chars+*#
dch1... delete_character........ Delete character+*
defc... define_char............. Define a character in a character set
dim.... enter_dim_mode.......... Turn on half-bright mode
dl..... parm_delete_line........ Delete #1 lines+*#
dl1.... delete_line............. Delete line+*
docr... these_cause_cr.......... List of characters that trigger carriage return
dsl.... dis_status_line......... Disable status line
ech.... erase_chars............. Erase no. 1 characters
ed..... clr_eos................. Clear to end of display+*
el..... clr_eol................. Clear to end of line+
el1.... clr_bol................. Clear to beginning of line, inclusive
enacs.. ena_acs................. Enable alternate character set
flash.. flash_screen............ Visible bell (may not move cursor)
ff..... form_feed............... Hardcopy terminal page eject+*
fsl.... from_status_line........ Return from status line
hd..... down_half_line.......... Half-line down (forward 1/2 linefeed)
home... cursor_home............. Move cursor to home position (if no cup)
hpa.... column_address.......... Set cursor column+#
ht..... tab..................... Tab to next eight-space hardware tab stop
hts.... set_tab................. Set a tab in all rows, current column.
hu..... up_half_line............ Half-line up (reverse 1/2 linefeed)
ich.... parm_ich................ Insert #1 blank characters+*#
ich1... insert_character........ Insert character+
if..... init_file............... Name of file containing is
il..... parm_insert_line........ Add #1 new blank lines+*#
il1.... insert_line............. Add new blank line+*
ind.... scroll_forward.......... Scroll text up+
indn... parm_index.............. Scroll forward #1 lines+#
initc.. initialize_color........ Initialize color definition
initp.. initialize_pair......... Initialize color pairs
invis.. enter_secure_mode....... Turn on blank mode (characters invisible)
ip..... insert_padding.......... Insert pad after character inserted+*
iprog.. init_prog............... Full path name of initialization program
is1.... init_1string............ Terminal-initialization string
is2.... init_2string............ Terminal-initialization string
is3.... init_3string............ Terminal-initialization string
kBEG... key_sbeg................ Sent by shifted beginning key
kCAN... key_scancel............. Sent by shifted cancel key
kCMD... key_scommand............ Sent by shifted command key
kCPY... key_scopy............... Sent by shifted copy key
kCRT... key_screate............. Sent by shifted create key
kDC.... key_sdc................. Sent by shifted delete-character key
kDL.... key_sdl................. Sent by shifted delete-line key
kEND... key_send................ Sent by shifted end key
kEOL... key_seol................ Sent by shifted EOL clear-line key
kEXT... key_sexit............... Sent by shifted exit key
kFND... key_sfind............... Sent by shifted find key
kHLP... key_shelp............... Sent by shifted help key
kHOM... key_shome............... Sent by shifted home key
kIC.... key_sic................. Sent by shifted input key
kLFT... key_sleft............... Sent by shifted <- key
kMOV... key_smove............... Sent by shifted move key
kMSG... key_smessage............ Sent by shifted message key
kNXT... key_snext............... Sent by shifted next key
kOPT... key_soptions............ Sent by shifted option key
kPRT... key_sprint.............. Sent by shifted print key
kPRV... key_sprevious........... Sent by shifted previous key
kRDO... key_sredo............... Sent by shifted redo key
kRES... key_srsume.............. Sent by shifted resume key
kRIT... key_sright.............. Sent by shifted -> key
kRPL... key_sreplace............ Sent by shifted replace key
kSAV... key_ssave............... Sent by shifted save key
kSPD... key_ssuspend............ Sent by shifted suspend key
kUND... key_sundo............... Sent by shifted undo key
ka1.... key_a1.................. Sent by key A1, upper left of keypad
ka3.... key_a3.................. Sent by key A3, upper right of keypad
kb2.... key_b2.................. Sent by key B2, center of keypad
kbeg... key_beg................. Sent by ``begin'' key
kbs.... key_backspace........... Sent by backspace key
kc1.... key_c1.................. Sent by key C1, lower left of keypad
kc3.... key_c3.................. Sent by key C3, lower right of keypad
kcan... key_cancel.............. Sent by cancel key
kcbt... key_btab................ Sent by back-tab key
kclo... key_close............... Sent by close key
kclr... key_clear............... Sent by clear-screen or erase key
kcmd... key_command............. Sent by ``cmd'' key
kcpy... key_copy................ Sent by copy key
kcrt... key_create.............. Sent by create key
kctab.. key_ctab................ Sent by clear-tab key
kcub1.. key_left................ Sent by <- key
kcud1.. key_down................ Sent by v key
kcuf1.. key_right............... Sent by -> key
kcuu1.. key_up.................. Sent by terminal ^ key
kdch1.. key_dc.................. Sent by delete-character key
kdl1... key_dl.................. Sent by delete-line key
ked.... key_eos................. Sent by clear-to-end-of-screen key
kel.... key_eol................. Sent by clear-to-end-of-line key
kend... key_end................. Sent by end key
kent... key_enter............... Sent by <return> key
kext... key_exit................ Sent by exit key
kf0.... key_f0.................. Sent by function key 0
kf1.... key_f1.................. Sent by function key 1
kf10... key_f10................. Sent by function key 10
kf11... key_f11................. Sent by function key 11
kf12... key_f12................. Sent by function key 12
kf13... key_f13................. Sent by function key 13
kf14... key_f14................. Sent by function key 14
kf15... key_f15................. Sent by function key 15
kf16... key_f16................. Sent by function key 16
kf17... key_f17................. Sent by function key 17
kf18... key_f18................. Sent by function key 18
kf19... key_f19................. Sent by function key 19
kf2.... key_f2.................. Sent by function key 2
kf20... key_f20................. Sent by function key 20
kf21... key_f21................. Sent by function key 21
kf22... key_f22................. Sent by function key 22
kf23... key_f23................. Sent by function key 23
kf24... key_f24................. Sent by function key 24
kf25... key_f25................. Sent by function key 25
kf26... key_f26................. Sent by function key 26
kf27... key_f27................. Sent by function key 27
kf28... key_f28................. Sent by function key 28
kf29... key_f29................. Sent by function key 29
kf3.... key_f3.................. Sent by function key 3
kf30... key_f30................. Sent by function key 30
kf31... key_f31................. Sent by function key 31
kf32... key_f32................. Sent by function key 32
kf33... key_f33................. Sent by function key 33
kf34... key_f34................. Sent by function key 34
kf35... key_f35................. Sent by function key 35
kf36... key_f36................. Sent by function key 36
kf37... key_f37................. Sent by function key 37
kf38... key_f38................. Sent by function key 38
kf39... key_f39................. Sent by function key 39
kf4.... key_f4.................. Sent by function key 4
kf40... key_f40................. Sent by function key 40
kf41... key_f41................. Sent by function key 41
kf42... key_f42................. Sent by function key 42
kf43... key_f43................. Sent by function key 43
kf44... key_f44................. Sent by function key 44
kf45... key_f45................. Sent by function key 45
kf46... key_f46................. Sent by function key 46
kf47... key_f47................. Sent by function key 47
kf48... key_f48................. Sent by function key 48
kf49... key_f49................. Sent by function key 49
kf5.... key_f5.................. Sent by function key 5
kf50... key_f50................. Sent by function key 50
kf51... key_f51................. Sent by function key 51
kf52... key_f52................. Sent by function key 52
kf53... key_f53................. Sent by function key 53
kf54... key_f54................. Sent by function key 54
kf55... key_f55................. Sent by function key 55
kf56... key_f56................. Sent by function key 56
kf57... key_f57................. Sent by function key 57
kf58... key_f58................. Sent by function key 58
kf59... key_f59................. Sent by function key 59
kf6.... key_f6.................. Sent by function key 6
kf60... key_f60................. Sent by function key 60
kf61... key_f61................. Sent by function key 61
kf62... key_f62................. Sent by function key 62
kf63... key_f63................. Sent by function key 63
kf7.... key_f7.................. Sent by function key 7
kf8.... key_f8.................. Sent by function key 8
kf9.... key_f9.................. Sent by function key 9
kfnd... key_find................ Sent by find key
khlp... key_help................ Sent by help key
khome.. key_home................ Sent by home key
khts... key_stab................ Sent by set-tab key
kich1.. key_ic.................. Sent by insert char/enter insert-mode key
kil1... key_il.................. Sent by insert line
kind... key_sf.................. Sent by scroll-forward/down key
kll.... key_ll.................. Sent by home-down key
kmrk... key_mark................ Sent by mark key
kmsg... key_message............. Sent by message key
kmov... key_move................ Sent by move key
knp.... key_npage............... Sent by next-page key
knxt... key_next................ Sent by next-object key
kopn... key_open................ Sent by open key
kopt... key_options............. Sent by options key
kpp.... key_ppage............... Sent by previous-page key
kprt... key_print............... Sent by print (copy) key
kprv... key_previous............ Sent by previous-object key
krdo... key_redo................ Sent by redo key
kref... key_reference........... Sent by reference key
kres... key_resume.............. Sent by resume key
krfr... key_refresh............. Sent by refresh key
kri.... key_sr.................. Sent by scroll-backward/up key
krmir.. key_eic................. Sent by rmir or smir in insert mode
krpl... key_replace............. Sent by replace key
krst... key_restart............. Sent by restart key
ksav... key_save................ Sent by save key
kslt... key_select.............. Sent by select key
kspd... key_suspend............. Sent by suspend key
ktbc... key_catab............... Sent by clear-all-tabs key
kund... key_undo................ Sent by undo key
lf0.... label_f0................ Label on function key 0 if not F0
lf1.... label_f1................ Label on function key 1 if not F1
lf10... label_f10............... Label on function key 10 if not F10
lf2.... label_f2................ Label on function key 2 if not F2
lf3.... label_f3................ Label on function key 3 if not F3
lf4.... label_f4................ Label on function key 4 if not F4
lf5.... label_f5................ Label on function key 5 if not F5
lf6.... label_f6................ Label on function key 6 if not F6
lf7.... label_f7................ Label on function key 7 if not F7
lf8.... label_f8................ Label on function key 8 if not F8
lf9.... label_f9................ Label on function key 9 if not F9
ll..... cursor_to_ll............ Last line, first column (if no cup)
lpi.... change_line_pitch....... Change number of lines per inch
mc0.... print_screen............ Print contents of the screen
mc4.... prtr_off................ Turn off printer
mc5.... prtr_on................. Turn on printer
mcub... parm_left_micro......... Like cub for micro adjustment
mcub1.. micro_left.............. Like cub1 for micro adjustment
mcud... parm_down_micro......... Like cud for micro adjustment
mcud1.. micro_down.............. Like cud1 for micro adjustment
mcuf... parm_right_micro........ Like cuf for micro adjustment
mcuf1.. micro_right............. Like cuf1 for micro adjustment
mcuu... parm_up_micro........... Like cuu for micro adjustment
mcuu1.. micro_up................ Like cuu1 for micro adjustment
mgc.... clear_margins........... Clear all margins (top, bottom, sides)
mhpa... micro_column_address.... Like hpa for micro adjustment
mrcup.. cursor_mem_address...... Memory-relative cursor addressing
mvpa... micro_row_address....... Like vpa for micro adjustment
nel.... newline................. Newline (behaves like CR followed by LF)
oc..... orig_colors............. Set all colors to originals
op..... orig_pair............... Set default color_pair to original
pad.... pad_char................ Pad character (rather than NUL)
pfkey.. pkey_key................ Program function key 1 to type string 2
pfloc.. pkey_local.............. Program function key 1 to execute string 2
pfx.... pkey_xmit............... Program function key 1 to transmit string 2
pln.... plab_norm............... Program label 1 to show string 2
porder. order_of_pins........... Match software bits to print-head pins
prot... enter_protected_mode.... Turn on protected mode
rc..... restore_cursor.......... Restore cursor to position of last sc
rep.... repeat_char............. Repeat character #1 #2 times. +*#
rev.... enter_reverse_mode...... Turn on reverse-video
rf..... reset_file.............. Name of file containing reset string
rfi.... reg_for_input........... Send next input character
ri..... scroll_reverse.......... Scroll text down+
rin.... parm_rindex............. Scroll backward one line+#
ritm... exit_italics_mode....... Disable italics
rlm.... exit_leftward_mode...... Enable rightward motion
rmacs.. exit_alt_charset_mode... End alternate character set+
rmam... exit_am_mode............ Turn off automatic margins
rmcup.. exit_ca_mode............ String to end programs that use cup
rmdc... exit_delete_mode........ End delete mode
rmicm.. exit_micro_mode......... Disable micro-motion capabilities
rmir... exit_insert_mode........ End insert mode
rmkx... keypad_local............ Exit ``keypad transmit'' mode
rmln... label_off............... Turn off soft labels
rmm.... meta_off................ Turn off ``meta mode''
rmp.... char_padding............ Like ip, but in replace mode
rmso... exit_standout_mode...... End stand out mode
rmul... exit_underline_mode..... End underscore mode
rmxon.. exit_xon_mode........... Turn off XON/XOFF handshaking
rs1.... reset_1string........... Reset terminal completely to sane modes
rs2.... reset_2string........... Reset terminal completely to sane modes
rs3.... reset_3string........... Reset terminal completely to sane modes
rshm... exit_shadow_mode........ Disable shadow printing
rsubm.. exit_subscript_mode..... Disable subscript printing
rsupm.. exit_superscript_mode... Disable superscript printing
rum.... exit_upward_motion...... Enable downward motion
rwidm.. exit_doublewide_mode.... Disable double-width printing
sbim... start_bit_margin........ Start printing bit-mapped graphics
sc..... save_cursor............. Save cursor position+
scp.... set_color_pair.......... Set current color pair
scs.... select_char_set......... Select character set
scsd... start_char_set_def...... Start definition of a character set
sdrfq.. enter_draft_quality..... Set draft-quality printing
setb... set_background.......... Set current background color
setf... set_foreground.......... Set current foreground color
sgr.... set_attributes.......... Define the nine video attributes+*#
sgr0... exit_attribute_mode..... Turn off all attributes
sitm... enter_italics_mode...... Enable italics
slm.... enter_leftward_mode..... Enable leftward carriage motion
smacs.. enter_alt_charset_mode.. Start alternate character set+
smam... enter_am_mode........... Turn on automatic margins
smcup.. enter_ca_mode........... String to begin programs that use cup
smdc... enter_delete_mode....... Delete mode (enter)
smgb... set_bottom_margin....... Set bottom margin to current line
smgbp.. set_bottom_margin_parm.. Set bottom margin at lines 1 or 2
smgl... set_left_margin......... Set left margin to current column
smglp.. set_left_margin_parm.... Set left margin to columns 1 or 2
smgr... set_right_margin........ Set right margin to current column
smgrp.. set_right_margin_parm... Set right margin to columns 1 or 2
smgt... set_top_margin.......... Set top margin to current line
smgtp.. set_top_margin_parm..... Set top margin to lines 1 or 2
smicm.. enter_micro_mode........ Enable micro-motion capabilities
smir... enter_insert_mode....... Insert mode (enter)
smkx... keypad_xmit............. Enter ``keypad transmit'' mode
smln... label_on................ Turn on soft labels
smm.... meta_on................. Turn on ``meta mode'' (eighth bit)
smso... enter_standout_mode..... Begin stand-out mode
smul... enter_underline_mode.... Start underscore mode
smxon.. enter_xon_mode.......... Turn on XON/XOFF handshaking
snlq... enter_near_letter_qualitySet near-letter-quality printing
snrmq.. enter_normal_quality.... Set normal-quality print
sshm... enter_shadow_mode....... Enable shadow printing
ssubm.. enter_subscript_mode.... Enable subscript printing
ssupm.. enter_superscript_mode.. Enable superscript printing
subcs.. subscript_characters.... List of ``subscript-able'' characters
sum.... enter_upward_mode....... Enable upward carriage motion
supcs.. superscript_characters.. List of ``superscript-able'' characters
swidm.. enter_doublewide_mode... Enable double-wide printing
tbc.... clear_all_tabs.......... Clear all tab stops+
tsl.... to_status_line.......... Go to status line, column 1
uc..... underline_char.......... Underscore one char and move past it
vpa.... row_address............. Vertical position absolute (set row)+#
wind... set_window.............. Current window is lines #1-#2, columns 3--4
xoffc.. xoff_character.......... XOFF character
xonc... xon_character........... XON character
zerom.. zero_motion............. No motion for subsequent character

Escape Sequences

You  can use  the  following escape  sequences  with any  string-capability
entry:

     \E        <esc> character
     \e        <esc> character
     ^X        <ctrl-X> for any appropriate X
     \n        Newline
     \r        Carriage return
     \t        Horizontal tab
     \b        Backspace
     \f        Formfeed
     \s        Space
     \000      Value of a character in three octal digits
     \^        Literal carat
     \,        Literal comma
     \\        Literal backslash

Parameterized Strings

Cursor-addressing and  other strings  requiring parameters in  the terminal
are  described by  a  parameterized string  capability, with  printf()-like
escape sequences in it.  Each  escape sequence is introduced with a percent
sign `%',  followed by one character that described  the type of formatting
to be performed, as follows:

     %%        Literal `%'
     %d        Decimal integer
     %2d       Decimal integer with at least two places
     %02d      Decimal integer, two places, zero padding
     %3d       Decimal integer with at least three places
     %03d      Decimal integer, three places, zero padding
     %c        Character
     %s        String

     %p[i]     Push ith parameter
     %P[a-z]   Set variable [a-z] to pop()
     %g[a-z]   Push variable [a-z]
     %'c'      Character constant c
     %{nn}     Integer constant nn

     %+        Addition: push(pop() + pop())
     %-        Subtraction: push(pop() - pop())
     %*        Multiplication: push(pop() * pop())
     %/        Division: push(pop() / pop())
     %m        Modulo: push(pop() % pop())
     %&amp;    Bitwise AND: push(pop() op pop())
     %|        Bitwise OR: push(pop() op pop())
     %^        Bitwise NOR: push(pop() op pop())
     %=        Logical AND: push(pop() op pop())
     %>     Logical OR: push(pop() op pop())
     %<     Logical NOR: push(pop() op pop())
     %!        Unary NOT: push(op pop())
     %~        Unary complement: push(op pop())
     %i        Add one to first two parmameters (for ANSI terminals)

The  parameterized  mechanism  is based  on  a  stack.   % operations  push
parameters and constants onto the stack, do arithmetic and other operations
on the  top of the stack,  and print out values in  various formats.  Up to
nine parameters can be used  at once.  If-then-else testing is possible, as
is storage  in a limited  number of variables.   There is no  provision for
loops or printing strings in any format other than %s.

For example, compare  the termcap entry cm and the  terminfo entry cup.  %+
(add space  and print as a  character) cm would be  treated as %p1%' '%+%c,
that is, push the first parameter, push space, add the top two numbers onto
the  stack, and  output the  top  item on  the stack  using character  (%c)
format.   For the  second parameter,  change %p1  to %p2.   %. (print  as a
character) becomes %p1%c. %d (print in decimal) becomes %p1%d.

As with tgoto(), characters standing by themselves (no `%' sign) are output
as is.

Alternate Characters

The  instruction  acsc  defines  a  set  of  alternate  characters.   These
alternate  characters define,  among other things,  the characters  used to
draw boxes.

acsc  is set  to  a string  composed  of pairs  of  characters.  The  first
character in each pair gives the character used by a VT100 in graphics mode
to display; the  second character is the one for  the terminal in use.  The
following table shows the VT100 graphic-character set:

     Arrow right         +
     Arrow left          ,
     Arrow down          .
     Full block (inverted space)0
     Lantern             I
     Arrow up            -
     Diamond             '
     Checkboard          a
     Degree              f
     +/- Sign            g
     Centered rectangles h
     Lower right corner  j
     Upper right corner  k
     Upper left corner   l
     Lower left corner   m
     Cross               n
     Upper horizontal lineo
     Middle horizontal lineq
     Lower horizontal lines
     Left tee            t
     Right tee           u
     Lower tee           v
     Upper tee           w
     Vertical line       x
     Centered dot        ~

Changes from termcap to terminfo

This section describes features of terminfo that termcap does not contain.

Defaults

terminfo  does not  contain every  default found  in termcap.  termcap, for
example,  assumed that  \r was  a  carriage return  unless nc  was present,
indicating  that  it  did  not  work,  or cr  was  present,  indicating  an
alternative.  In  terminfo, if  cr is present,  the string so  given works;
otherwise it should be assumed not to work.  The bs and bc capabilities are
replaced by cub and cub1.  (The  former takes a parameter, moving left that
many spaces.   The latter  is probably more  common in terminals  and moves
left  one space.)  nl (linefeed)  has been split  into two  functions: cud1
(moves the  cursor down one  line) and ind (scroll  forward).  cud1 applies
when the  cursor is not on  the bottom line, ind applies when  it is on the
bottom line.  The bell capability is now explicitly given as bel.

The  terminfo data  base is  compiled, unlike termcap.   This means  that a
terminfo source file (describing some set of terminals) is processed by the
terminfo compiler, producing a binary description of the terminal in a file
under  /usr/lib/terminfo. The  function setupterm()  reads this  file.  The
advantage to  compilation is that  starting up a program  using terminfo is
faster.  The  increase in speed comes  partly from not having  to skip past
other terminal descriptions, and partly from the compiler having sorted the
capabilities into order so that a linear scan can read them in.

The terminfo compiler tic uses  the environment variable TERMINFO to be the
destination  directory  of  the new  object  files.   It  is  also used  by
setupterm() to find  an entry for a given terminal.   First it looks in the
directory   given   in   TERMINFO  and,   if   not   found  there,   checks
/usr/lib/terminfo.

Basic Example

The following  gives the  terminfo description  for a simple  terminal, the
Lear-Siegler ADM-3:

    adm3|3|lsi adm3,
        cr=^M, cud1=^J, ind=^J, bel=^G,
        am, cub1=^H, clear=^Z, lines#24, cols#80

As you  can see,  the description  is divided into  comma-separated fields.
The following discusses each field in detail.

adm3|3|lsi adm3,
        The first field names  the terminal.  This field  is unique in that
        it is divided into  a number of sub-fields,  which are separated by
        vertical bar  characters.  The  first sub-field  gives the  name by
        which the  terminal is  normally addressed in  a program;  the last
        gives a longer, descriptive name.

cr=^M,  To move the cursor to the left margin, send <ctrl-M>.

cud1=^J,
        To move the cursor down one row, send <ctrl-J>.

ind=^J,
        To scroll the screen up, send <ctrl-J>.  Note that the ADM-3,
        like most terminals,  does not scroll  unless the cursor  is on the
        last row.

bel=^G,
        To ring the terminal's bell, send <ctrl-G>.

am,     This boolean code  indicates that the  ADM-3 wraps to  the leftmost
        column of the of the next row when the cursor reaches the rightmost
        column.

cub1=^H,
        To move the  cursor nondestructively one  column to the  left, send
        <ctrl-H>.

clear=^Z,
        To clear the screen, send <ctrl-Z>.

lines#24,
        The ADM-3 has 24 rows (lines).

cols#80,
        The ADM-3 has 80 columns.

Modifying an Entry

A full discussion of how to  modify a terminfo entry is beyond the scope of
this  article.  The  references, below, name  several volumes  that discuss
this topic at length.

In  brief, modifying  a terminfo  entry requires that  you use  the command
infocmp to  de-compile the entry for  a given terminal, modify  the text by
hand, then use the command tic to recompile and re-install the entry.

C-Level Routines

The library /usr/lib/libcurses.a contains a suite of C functions with which
you can read a  given terminal's terminfo capabilities.  You must reference
the terminfo  capabilities in your program as  global variables whose names
are  identical to  the  full names  of the  capabilities themselves;  e.g.,
auto_left_margin.  These  functions   are  declared  in  the  header  files
<curses.h> <term.h>, and <terminfo.h>; note that you must
#include all three header files in your C program.

You can  call the  following functions  from within a  C program to  read a
terminfo entry:

fixterm()      Set the terminal into program mode
putp()         Write a string into stdwin
resetterm()    Reset the terminal into a saved mode
setupterm()    Initialize terminal capabilities
tparm()        Output a parameterized string
tputs()        Process a capability string
vidattr()      Set the terminal's video attributes
vidputs()      Set video attributes into a function

setupterm() initializes  a terminal.  It inhales  all terminal capabilities
at once, and performs all other system-dependent initialization.

A program should call resetterm() when it exits or calls a shell escape, to
restore the  tty modes.  When it  returns from a shell  escape, the program
should call fixterm() to set the tty modes back to their internal settings.

tparm() is  a more powerful, parameterized  string mechanism.  It resembles
the termcap function tgoto(). tgoto() is still available for compatibility.
tputs() is unchanged.

Files

/usr/lib/libcurses.a -- Routines for reading terminfo descriptions
/usr/lib/terminfo/?/* -- Directories containing compiled descriptions

See Also

Administering COHERENT,
captoinfo,
curses,
fixterm(),
infocmp,
putp(),
resetterm(),
setupterm(),
term,
termcap,
tic,
tparm(),
tputs(),
vi,
vidputs()
Strang, J.,  Mui, L., O'Reilly, T.: Termcap  and Terminfo.  Sebastopol, CA:
O'Reilly & Associates, Inc., 1991.  Highly recommended.

Notes

As mentioned above, each terminfo description is kept in its own file, in a
subdirectory of  directory /usr/lib/terminfo. Each file  is named after the
device  it describes.   Thus, to  see what  terminal devices  have terminfo
descriptions, type the command:

    ls -laR /usr/lib/terminfo

You  may wish  to redirect  the  output of  this command  into a  file, for
further study later on.

This  implementation of  terminfo was  written by  Pavel Curtis  of Cornell
University.  It was ported to COHERENT by Udo Munk.