Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > T

terminfo(4)

ENHANCED CURSES
HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

terminfo — printer, terminal, and modem capability database

SYNOPSIS

/usr/lib/terminfo/?/*

DESCRIPTION

The requirements in this manpage are in effect only for implementations that claim Enhanced Curses compliance.

List of Section Headings in DESCRIPTION

Terminfo Source Format Source File Syntax Minimum Guaranteed Limits Formal Grammar Defined Capabilities Sample Entry Types of Capabilities in the Sample Entry Device Capabilities Insert/Delete Line Printer Capabilities Capabilities that Cause Movement Alternate Character Sets Dot-Matrix Graphics Effect of Changing Printing Resolution Selecting a Terminal Application Usage

Terminfo Source Format

The terminfo database contains a description of the capabilities of a variety of devices, such as terminals and printers. Devices are described by specifying a set of capabilities, by quantifying certain aspects of the device, and by specifying character sequences that effect particular results.

This manpage specifies the format of terminfo source files.

X/Open-compliant implementations must provide a facility that accepts source files in the format specified in this manpage as a means of entering information into the terminfo database. The facility for installing this information into the database is implementation-specific. A valid terminfo entry describing a given model of terminal can be added to terminfo on any X/Open-compliant implementation to permit use of the same terminal model.

The Source File Syntax section describes the syntax of terminfo source files. A grammar and lexical conventions appear in the Formal Grammar section below. A list of all terminal capabilities defined by X/Open appears in the Defined Capabilities section below. An example follows in the Sample Entry section below. The Device Capabilities section describes the specification of devices in general, such as video terminals. The Printer Capabilities section describes the specification of printers.

The terminfo database is often used by screen-oriented applications such as vi and Curses programs, as well as by some utilities such as ls and more. This usage allows them to work with a variety of devices without changes to the programs.

Source File Syntax

Source files can use the ISO 8859-1 codeset. The behavior when the source file is in another codeset is unspecified. Traditional practice has been to translate information from other codesets into the source file syntax.

terminfo source files consist of one or more device descriptions. Each description defines a mnemonic name for the terminal model. Each description consists of a header (beginning in column 1) and one or more lines that list the features for that particular device. Every line in a terminfo source file must end in a comma. Every line in a terminfo source file except the header must be indented with one or more white spaces (either spaces or tabs).

Entries in terminfo source files consist of a number of comma-separated fields. White space after each comma is ignored. Embedded commas must be escaped by using a backslash. The following example shows the format of a terminfo source file:

alias1 | alias2 | ... | aliasn | longname, whitespaceam, lines #24, whitespacehome=\Eeh,

The first line, commonly referred to as the header line, must begin in column one and must contain at least two aliases separated by vertical bars. The last field in the header line must be the long name of the device and it may contain any string.

Alias names must be unique in the terminfo database and they must conform to file naming conventions established by implementation-specific terminfo compilation utilities. Implementations will recognize alias names consisting only of characters from the portable file name character set except that implementations need not accept a first character of minus (-). For example, a typical restriction is that they cannot contain white space or slashes. There may be further constraints imposed on source file values by the implementation-specific terminfo compilation utilities.

Each capability in terminfo is of one of the following types:

  • Boolean capabilities show that a device has or does not have a particular feature.

  • Numeric capabilities quantify particular features of a device.

  • String capabilities provide sequences that can be used to perform particular operations on devices.

Capability names adhere to an informal length limit of five characters. Whenever possible, capability names are chosen to be the same as or similar to those specified by the ANSI X3.64-1979 standard. Semantics are also intended to match those of the ANSI standard.

All string capabilities may have padding specified, with the exception of those used for input. Input capabilities, listed under the Strings section in the following tables, have names beginning with key_. These capabilities are defined in <term.h>.

Minimum Guaranteed Limits

All X/Open-compliant implementations support at least the following limits for the terminfo source file:

Source File CharacteristicMinimum Guaranteed Value
Length of a line1023 bytes
Length of a terminal alias14 bytes
Length of a terminal model name128 bytes
Width of a single field128 bytes
Length of a string value1000 bytes
Length of a string representing a numeric value99 digits
Magnitude of a numeric value0 to 32767 inclusive

An implementation may support higher limits than those specified above.

Formal Grammar

The grammar and lexical conventions in this section together describe the syntax for terminfo terminal descriptions within a terminfo source file. A terminal description that satisfies the requirements of this section will be accepted by all implementations. (The notation "(n)" refers to a note following the description.)

descriptions : START_OF_HEADER_LINE(1) rest_of_header_line feature_lines | descriptions START_OF_HEADER_LINE rest_of_header_line | feature_lines ; rest_of_header_line : PIPE LONGNAME COMMA NEWLINE | aliases PIPE LONGNAME COMMA NEWLINE ; feature_lines : start_feature_line rest_of_feature_line | feature_lines start_feature_line rest_of_feature_line ; start_feature_line : START_FEATURE_LINE_BOOLEAN(2) | START_FEATURE_LINE_NUMERIC(3) | START_FEATURE_LINE_STRING(4) ; rest_of_feature_line : features COMMA NEWLINE | COMMA NEWLINE ; features : COMMA feature | features COMMA feature ; aliases : PIPE ALIAS | aliases PIPE ALIAS ; feature : BOOLEAN | NUMERIC | STRING ;

Note (1)

An ALIAS that begins in column one. This is handled by the lexical analyzer.

Note (2)

A BOOLEAN feature that begins after column one but is the first feature on the feature line. This is handled by the lexical analyzer.

Note (3)

A NUMERIC feature that begins after column one but is the first feature on the feature line. This is handled by the lexical analyzer.

Note (4)

A STRING feature that begins after column one but is the first feature on the feature line. This is handled by the lexical analyzer.

The lexical conventions for terminfo descriptions are as follows:

1.

White space consists of the <space> and <tab> characters.

2.

An ALIAS may contain any graph characters other than comma (,), slash (/), and bar (|). (Graph characters are those characters for which isgraph() returns nonzero; see ctype(3C).)

3.

A LONGNAME may contain any print characters other than comma (,) and bar (|). (Print characters are those characters for which isprint() returns nonzero; see ctype(3C).)

4.

A BOOLEAN feature may contain any print characters other than comma (,), equals (=), and pound sign (#).

5.

A NUMERIC feature consists of:

a.

A name which may contain any print character other than comma (,), equals (=), and pound sign (#).

b.

The pound sign (#) character.

c.

A positive integer which conforms to the C language convention for integer constants.

6.

A STRING feature consists of:

a.

A name which may contain any print character other than comma (,), equals (=), and pound sign (#).

b.

The equals (=) character.

c.

A string which may contain any print characters other than comma (,).

7.

White space immediately following a comma (,) is ignored.

8.

Comments consist of the beginning of a line, optional white space, a required pound sign (#), and a terminating end of line.

9.

A header line must begin in column one.

10.

A feature line must not begin in column one.

11.

Blank lines are ignored.

Defined Capabilities

X/Open defines the capabilities listed in the following tables. All X/Open-compliant implementations must accept each of these capabilities in an entry in a terminfo source file. Implementations use this information to determine how properly to operate the current terminal. In addition, implementations return any of the current terminal's capabilities when the application calls the query functions listed in tgetent() (in the cases where the following tables list a Termcap code) and tigetflag() (see tgetent(3X) and tigetflag(3X)).

The tables of capabilities have the following columns:

Variable

Names for use by the Curses functions that operate on the terminfo database. These names are reserved and the application must not define them.

Capname

The short name for a capability specified in the terminfo source file. It is used for updating the source file and by the tput command (see tput(1)).

Termcap

Codes provided for compatibility with older applications. These codes are TO BE WITHDRAWN. Because of this, not all Capnames have Termcap codes.

Description

A short summary of the capability.

Booleans

 CapTerm 
VariablenamecapDescription
auto_left_marginbwbwcub1 wraps from column 0 to last column
auto_right_marginamamTerminal has automatic margins
back_color_erasebceutScreen erased with background color
can_changecccccTerminal can re-define existing color
ceol_standout_glitchxhpxsStandout not erased by overwriting (hp)
col_addr_glitchxhpaYAOnly positive motion for hpa/mhpa caps
cpi_changes_rescpixYFChanging character pitch changes resolution
cr_cancels_micro_modecrxmYBUsing cr turns off micro mode
dest_tabs_magic_smsoxtxtDestructive tabs, magic smso char (t1061)
eat_newline_glitchxenlxnNewline ignored after 80 columns (Concept)
erase_overstrikeeoeoCan erase overstrikes with a blank
generic_typegngnGeneric line type (e.g., dialup, switch)
get_mousegetmGmCurses should get button events
hard_copyhchcHardcopy terminal
hard_cursorchtsHCCursor is hard to see
has_meta_keykmkmHas a meta key (shift, sets parity bit)
has_print_wheeldaisyYCPrinter needs operator to change character set
has_status_linehshsHas extra "status line"
hue_lightness_saturationhlshlTerminal uses only HLS color notation (Tektronix)
insert_null_glitchininInsert mode distinguishes nulls
lpi_changes_reslpixYGChanging line pitch changes resolution
memory_abovedadaDisplay may be retained above the screen
memory_belowdbdbDisplay may be retained below the screen
move_insert_modemirmiSafe to move while in insert mode
move_standout_modemsgrmsSafe to move in standout modes
needs_xon_xoffnxonnxPadding won't work, XON/XOFF required
no_esc_ctlcxsbxbBeehive (f1=escape, f2=ctrl C)
no_pad_charnpcNPPad character doesn't exist
non_dest_scroll_regionndscrNDScrolling region is nondestructive
non_rev_rmcupnrrmcNRsmcup does not reverse rmcup
over_strikeososTerminal overstrikes on hard-copy terminal
prtr_silentmc5i5iPrinter won't echo on screen
row_addr_glitchxvpaYDOnly positive motion for vpa/mvpa caps
semi_auto_right_marginsamYEPrinting in last column causes cr
status_line_esc_okeslokesEscape can be used on the status line
tilde_glitchhzhzHazeltine; can't print tilde (~)
transparent_underlineululUnderline character overstrikes
xon_xoffxonxoTerminal uses XON/XOFF handshaking

Numbers

 CapTerm 
VariablenamecapDescription
bit_image_entwiningbitwinYoNumber of passes for each bit-map row
bit_image_typebitypeYpType of bit image device
buffer_capacitybufszYaNumber of bytes buffered before printing
buttonsbtnsBTNumber of buttons on the mouse
columnscolscoNumber of columns in a line
dot_horz_spacingspinhYcSpacing of dots horizontally in dots per inch
dot_vert_spacingspinvYbSpacing of pins vertically in pins per inch
init_tabsititTabs initially every # spaces
label_heightlhlhNumber of rows in each label
label_widthlwlwNumber of columns in each label
lineslinesliNumber of lines on a screen or a page
lines_of_memorylmlmLines of memory if greater than lines; 0 means varies
max_attributesmamaMaximum combined video attributes terminal can display
magic_cookie_glitchxmcsgNumber of blank characters left by smso or rmso
max_colorscolorsCoMaximum number of colors on the screen
max_micro_addressmaddrYdMaximum value in micro_..._address
max_micro_jumpmjumpYeMaximum value in parm_..._micro
max_pairspairspaMaximum number of color-pairs on the screen
maximum_windowswnumMWMaximum number of definable windows
micro_col_sizemcsYfCharacter step size when in micro mode
micro_line_sizemlsYgLine step size when in micro mode
no_color_videoncvNCVideo attributes that can't be used with colors
num_labelsnlabNlNumber of labels on screen (start at 1)
number_of_pinsnpinsYhNumber of pins in print-head
output_res_charorcYiHorizontal resolution in units per character
output_res_lineorlYjVertical resolution in units per line
output_res_horz_inchorhiYkHorizontal resolution in units per inch
output_res_vert_inchorviYlVertical resolution in units per inch
padding_baud_ratepbpbLowest baud rate where padding needed
print_ratecpsYmPrint rate in characters per second
virtual_terminalvtvtVirtual terminal number
wide_char_sizewidcsYnCharacter step size when in double-wide mode
width_status_linewslwsNumber of columns in status line

Strings (part 1 of 3)

 CapTerm 
VariablenamecapDescription
acs_charsacscacGraphic charset pairs aAbBcC
alt_scancode_escscesaS8Alternate escape for scancode emulation (default is for VT100)
back_tabcbtbtBack tab
bellbelblAudible signal (bell)
bit_image_carriage_returnbicrYvMove to beginning of same row
bit_image_newlinebinelZzMove to next row of the bit image
bit_image_repeatbirepXyRepeat bit-image cell #1 #2 times
carriage_returncrcrCarriage return
change_char_pitchcpiZAChange number of characters per inch
change_line_pitchlpiZBChange number of lines per inch
change_res_horzchrZCChange horizontal resolution
change_res_vertcvrZDChange vertical resolution
change_scroll_regioncsrcsChange to lines #1 through #2 (VT100)
char_paddingrmprPLike ip but when in replace mode
char_set_namescsnmZyReturns a list of character set names
clear_all_tabstbcctClear all tab stops
clear_marginsmgcMCClear all margins (top, bottom, and sides)
clear_screenclearclClear screen and home cursor
clr_bolel1cbClear to beginning of line, inclusive
clr_eolelceClear to end of line
clr_eosedcdClear to end of display
code_set_initcsinciInit sequence for multiple codesets
color_namescolornmYwGive name for color #1
column_addresshpachSet horizontal position to absolute #1
command_charactercmdchCCTerminal settable cmd character in prototype
create_windowcwinCWDefine win #1 to go from #2,#3 to #4,#5
cursor_addresscupcmMove to row #1 col #2
cursor_downcud1doDown one line
cursor_homehomehoHome cursor (if no cup)
cursor_invisiblecivisviMake cursor invisible
cursor_leftcub1leMove left one space.
cursor_mem_addressmrcupCMMemory relative cursor addressing
cursor_normalcnormveMake cursor appear normal (undo vs/vi)
cursor_rightcuf1ndNondestructive space (cursor or carriage right)
cursor_to_llllllLast line, first column (if no cup)
cursor_upcuu1upUpline (cursor up)
cursor_visiblecvvisvsMake cursor very visible
define_bit_image_regiondefbiYxDefine rectangular bit-image region
define_chardefcZEDefine a character in a character set
delete_characterdch1dcDelete character
delete_linedl1dlDelete line
device_typedevtdvIndicate language/codeset support
dial_phonedialDIDial phone number #1
dis_status_linedsldsDisable status line
display_clockdclkDKDisplay time-of-day clock
display_pc_chardispcS1Display PC character
down_half_linehdhdHalf-line down (forward 1/2 line feed)
ena_acsenacseAEnable alternate character set
end_bit_image_regionendbiYyEnd a bit-image region
enter_alt_charset_modesmacsasStart alternate character set
enter_am_modesmamSATurn on automatic margins
enter_blink_modeblinkmbTurn on blinking
enter_bold_modeboldmdTurn on bold (extra bright) mode
enter_ca_modesmcuptiString to begin programs that use cup
enter_delete_modesmdcdmDelete mode (enter)
enter_dim_modedimmhTurn on half-bright mode
enter_doublewide_modeswidmZFEnable double wide printing
enter_draft_qualitysdrfqZGSet draft quality print
enter_horizontal_hl_modeehhlmTurn on horizontal highlight mode
enter_insert_modesmirimInsert mode (enter)
enter_italics_modesitmZHEnable italics
enter_left_hl_modeelhlmTurn on left highlight mode
enter_leftward_modeslmZIEnable leftward carriage motion
enter_low_hl_modeelohlmTurn on low highlight mode
enter_micro_modesmicmZJEnable micro motion capabilities
enter_near_letter_qualitysnlqZKSet near-letter quality print
enter_normal_qualitysnrmqZLSet normal quality print
enter_pc_charset_modesmpchS2Enter PC character display mode
enter_protected_modeprotmpTurn on protected mode
enter_reverse_moderevmrTurn on reverse video mode
enter_right_hl_modeerhlmTurn on right highlight mode
enter_scancode_modesmscS4Enter PC scancode mode
enter_secure_modeinvismkTurn on blank mode (characters invisible)
enter_shadow_modesshmZMEnable shadow printing
enter_standout_modesmsosoBegin standout mode
enter_subscript_modessubmZNEnable subscript printing
enter_superscript_modessupmZOEnable superscript printing
enter_top_hl_modeethlmTurn on top highlight mode
enter_underline_modesmulusStart underscore mode
enter_upward_modesumZPEnable upward carriage motion
enter_vertical_hl_modeevhlmTurn on vertical highlight mode
enter_xon_modesmxonSXTurn on XON/XOFF handshaking
erase_charsechecErase #1 characters
exit_alt_charset_modermacsaeEnd alternate character set
exit_am_modermamRATurn off automatic margins
exit_attribute_modesgr0meTurn off all attributes
exit_ca_modermcupteString to end programs that use cup
exit_delete_modermdcedEnd delete mode
exit_doublewide_moderwidmZQDisable double wide printing
exit_insert_modermireiEnd insert mode
exit_italics_moderitmZRDisable italics
exit_leftward_moderlmZSEnable rightward (normal) carriage motion
exit_micro_modermicmZTDisable micro motion capabilities
exit_pc_charset_modermpchS3Disable PC character display mode
exit_scancode_modermscS5Disable PC scancode mode
exit_shadow_modershmZUDisable shadow printing
exit_standout_modermsoseEnd standout mode
exit_subscript_modersubmZVDisable subscript printing
exit_superscript_modersupmZWDisable superscript printing
exit_underline_modermulueEnd underscore mode
exit_upward_moderumZXEnable downward (normal) carriage motion
exit_xon_modermxonRXTurn off XON/XOFF handshaking
fixed_pausepausePAPause for 2-3 seconds
flash_hookhookfhFlash the switch hook
flash_screenflashvbVisible bell (may move cursor)
form_feedffffHardcopy terminal page eject
from_status_linefslfsReturn from status line
goto_windowwingoWGGo to window #1
hanguphupHUHang-up phone
init_1stringis1i1Terminal or printer initialization string
init_2stringis2isTerminal or printer initialization string
init_3stringis3i3Terminal or printer initialization string
init_fileififName of initialization file
init_progiprogiPPath name of program for initialization
initialize_colorinitcICSet color #1 to RGB #2, #3, #4
initialize_pairinitpIpSet color-pair #1 to RGB #2, #3, #4 (fg) and RGB #5, #6, #7 (bg)
insert_characterich1icInsert character
insert_lineil1alAdd new blank line
insert_paddingipipInsert pad after character inserted

Strings (part 2 of 3)

The "key_" strings are sent by specific keys. The "key_" descriptions include the macro, defined in <curses.h>, for the code returned by getch() when the key is pressed (see getch(3X)).

 CapTerm 
VariablenamecapDescription
key_a1ka1K1Upper left of keypad
key_a3ka3K3Upper right of keypad
key_b2kb2K2Center of keypad
key_backspacekbskbSent by backspace key
key_begkbeg@1Sent by beg(inning) key
key_btabkcbtkBSent by back-tab key
key_c1kc1K4Lower left of keypad
key_c3kc3K5Lower right of keypad
key_cancelkcan@2Sent by cancel key
key_catabktbckaSent by clear-all-tabs key
key_clearkclrkCSent by clear-screen or erase key
key_closekclo@3Sent by close key
key_commandkcmd@4Sent by cmd (command) key
key_copykcpy@5Sent by copy key
key_createkcrt@6Sent by create key
key_ctabkctabktSent by clear-tab key
key_dckdch1kDSent by delete-character key
key_dlkdl1kLSent by delete-line key
key_downkcud1kdSent by terminal down-arrow key
key_eickrmirkMSent by rmir or smir in insert mode
key_endkend@7Sent by end key
key_enterkent@8Sent by enter/send key
key_eolkelkESent by clear-to-end-of-line key
key_eoskedkSSent by clear-to-end-of-screen key
key_exitkext@9Sent by exit key
key_f0kf0k0Sent by function key f0
key_f1kf1k1Sent by function key f1
key_f2kf2k2Sent by function key f2
key_f3kf3k3Sent by function key f3
key_f4kf4k4Sent by function key f4
key_f5kf5k5Sent by function key f5
key_f6kf6k6Sent by function key f6
key_f7kf7k7Sent by function key f7
key_f8kf8k8Sent by function key f8
key_f9kf9k9Sent by function key f9
key_f10kf10k;Sent by function key f10
key_f11kf11F1Sent by function key f11
key_f12kf12F2Sent by function key f12
key_f13kf13F3Sent by function key f13
key_f14kf14F4Sent by function key f14
key_f15kf15F5Sent by function key f15
key_f16kf16F6Sent by function key f16
key_f17kf17F7Sent by function key f17
key_f18kf18F8Sent by function key f18
key_f19kf19F9Sent by function key f19
key_f20kf20FASent by function key f20
key_f21kf21FBSent by function key f21
key_f22kf22FCSent by function key f22
key_f23kf23FDSent by function key f23
key_f24kf24FESent by function key f24
key_f25kf25FFSent by function key f25
key_f26kf26FGSent by function key f26
key_f27kf27FHSent by function key f27
key_f28kf28FISent by function key f28
key_f29kf29FJSent by function key f29
key_f30kf30FKSent by function key f30
key_f31kf31FLSent by function key f31
key_f32kf32FMSent by function key f32
key_f33kf33FNSent by function key f33
key_f34kf34FOSent by function key f34
key_f35kf35FPSent by function key f35
key_f36kf36FQSent by function key f36
key_f37kf37FRSent by function key f37
key_f38kf38FSSent by function key f38
key_f39kf39FTSent by function key f39
key_f40kf40FUSent by function key f40
key_f41kf41FVSent by function key f41
key_f42kf42FWSent by function key f42
key_f43kf43FXSent by function key f43
key_f44kf44FYSent by function key f44
key_f45kf45FZSent by function key f45
key_f46kf46FaSent by function key f46
key_f47kf47FbSent by function key f47
key_f48kf48FcSent by function key f48
key_f49kf49FdSent by function key f49
key_f50kf50FeSent by function key f50
key_f51kf51FfSent by function key f51
key_f52kf52FgSent by function key f52
key_f53kf53FhSent by function key f53
key_f54kf54FiSent by function key f54
key_f55kf55FjSent by function key f55
key_f56kf56FkSent by function key f56
key_f57kf57FlSent by function key f57
key_f58kf58FmSent by function key f58
key_f59kf59FnSent by function key f59
key_f60kf60FoSent by function key f60
key_f61kf61FpSent by function key f61
key_f62kf62FqSent by function key f62
key_f63kf63FrSent by function key f63
key_findkfnd@0Sent by find key
key_helpkhlp%1Sent by help key
key_homekhomekhSent by home key
key_ickich1kISent by ins-char/enter ins-mode key
key_ilkil1kASent by insert-line key
key_leftkcub1klSent by terminal left-arrow key
key_llkllkHSent by home-down key
key_markkmrk%2Sent by mark key
key_messagekmsg%3Sent by message key
key_mousekmousKm0631, mouse event has occurred
key_movekmov%4Sent by move key
key_nextknxt%5Sent by next-object key
key_npageknpkNSent by next-page key
key_openkopn%6Sent by open key
key_optionskopt%7Sent by options key
key_ppagekppkPSent by previous-page key
key_previouskprv%8Sent by previous-object key
key_printkprt%9Sent by print or copy key
key_redokrdo%0Sent by redo key
key_referencekref&1Sent by ref(erence) key
key_refreshkrfr&2Sent by refresh key
key_replacekrpl&3Sent by replace key
key_restartkrst&4Sent by restart key
key_resumekres&5Sent by resume key
key_rightkcuf1krSent by terminal right-arrow key
key_saveksav&6Sent by save key
key_sbegkBEG&9Sent by shifted beginning key
key_scancelkCAN&0Sent by shifted cancel key
key_scommandkCMD*1Sent by shifted command key
key_scopykCPY*2Sent by shifted copy key
key_screatekCRT*3Sent by shifted create key
key_sdckDC*4Sent by shifted delete-char key
key_sdlkDL*5Sent by shifted delete-line key
key_selectkslt*6Sent by select key
key_sendkEND*7Sent by shifted end key
key_seolkEOL*8Sent by shifted clear-line key
key_sexitkEXT*9Sent by shifted exit key
key_sfkindkFSent by scroll-forward/down key
key_sfindkFND*0Sent by shifted find key
key_shelpkHLP#1Sent by shifted help key
key_shomekHOM#2Sent by shifted home key
key_sickIC#3Sent by shifted input key
key_sleftkLFT#4Sent by shifted left-arrow key
key_smessagekMSG%aSent by shifted message key
key_smovekMOV%bSent by shifted move key
key_snextkNXT%cSent by shifted next key
key_soptionskOPT%dSent by shifted options key
key_spreviouskPRV%eSent by shifted prev key
key_sprintkPRT%fSent by shifted print key
key_srkrikRSent by scroll-backward/up key
key_sredokRDO%gSent by shifted redo key
key_sreplacekRPL%hSent by shifted replace key
key_srightkRIT%iSent by shifted right-arrow key
key_srsumekRES%jSent by shifted resume key
key_ssavekSAV!1Sent by shifted save key
key_ssuspendkSPD!2Sent by shifted suspend key
key_stabkhtskTSent by set-tab key
key_sundokUND!3Sent by shifted undo key
key_suspendkspd&7Sent by suspend key
key_undokund&8Sent by undo key
key_upkcuu1kuSent by terminal up-arrow key

Strings (part 3 of 3)

 CapTerm 
VariablenamecapDescription
keypad_localrmkxkeOut of "keypad-transmit" mode
keypad_xmitsmkxksPut terminal in "keypad-transmit" mode
lab_f0lf0l0Labels on function key f0 if not f0
lab_f1lf1l1Labels on function key f1 if not f1
lab_f2lf2l2Labels on function key f2 if not f2
lab_f3lf3l3Labels on function key f3 if not f3
lab_f4lf4l4Labels on function key f4 if not f4
lab_f5lf5l5Labels on function key f5 if not f5
lab_f6lf6l6Labels on function key f6 if not f6
lab_f7lf7l7Labels on function key f7 if not f7
lab_f8lf8l8Labels on function key f8 if not f8
lab_f9lf9l9Labels on function key f9 if not f9
lab_f10lf10laLabels on function key f10 if not f10
label_formatflnLfLabel format
label_offrmlnLFTurn off soft labels
label_onsmlnLOTurn on soft labels
memory_lockmemlmlLock memory above cursor
memory_unlockmemumuTurn memory lock off
meta_offrmmmoTurn off "meta mode"
meta_onsmmmmTurn on "meta mode" (8th bit)
micro_column_addressmhpaZYLike column_address for micro adjustment
micro_downmcud1ZZLike cursor_down for micro adjustment
micro_leftmcub1ZaLike cursor_left for micro adjustment
micro_rightmcuf1ZbLike cursor_right for micro adjustment
micro_row_addressmvpaZcLike row_address for micro adjustment
micro_upmcuu1ZdLike cursor_up for micro adjustment
mouse_infominfoMiMouse status information
newlinenelnwNewline (behaves like cr followed by lf)
order_of_pinsporderZeMatches software bits to print-head pins
orig_colorsococSet all color(-pair)s to the original ones
orig_pairopopSet default color-pair to the original one
pad_charpadpcPad character (rather than null)
parm_dchdchDCDelete #1 chars
parm_delete_linedlDLDelete #1 lines
parm_down_cursorcudDOMove down #1 lines.
parm_down_micromcudZfLike parm_down_cursor for micro adjust.
parm_ichichICInsert #1 blank chars
parm_indexindnSFScroll forward #1 lines.
parm_insert_lineilALAdd #1 new blank lines
parm_left_cursorcubLEMove cursor left #1 spaces
parm_left_micromcubZgLike parm_left_cursor for micro adjust.
parm_right_cursorcufRIMove right #1 spaces.
parm_right_micromcufZhLike parm_right_cursor for micro adjust.
parm_rindexrinSRScroll backward #1 lines.
parm_up_cursorcuuUPMove cursor up #1 lines.
parm_up_micromcuuZiLike parm_up_cursor for micro adjust.
pc_term_optionspctrmS6PC terminal options
pkey_keypfkeypkProg funct key #1 to type string #2
pkey_localpflocplProg funct key #1 to execute string #2
pkey_plabpfxlxlProg key #1 to xmit string #2 and show string #3
pkey_xmitpfxpxProg funct key #1 to xmit string #2
plab_normplnpnProg label #1 to show string #2
print_screenmc0psPrint contents of the screen
prtr_nonmc5ppOTurn on the printer for #1 bytes
prtr_offmc4pfTurn off the printer
prtr_onmc5poTurn on the printer
pulsepulsePUSelect pulse dialing
quick_dialqdialQDDial phone number #1, without progress detection
remove_clockrmclkRCRemove time-of-day clock
repeat_charreprpRepeat char #1 #2 times
req_for_inputrfiRFSend next input char (for ptys)
req_mouse_posreqmpRQRequest mouse position report
reset_1stringrs1r1Reset terminal completely to sane modes
reset_2stringrs2r2Reset terminal completely to sane modes
reset_3stringrs3r3Reset terminal completely to sane modes
reset_filerfrfName of file containing reset string
restore_cursorrcrcRestore cursor to position of last sc
row_addressvpacvSet vertical position to absolute #1
save_cursorscscSave cursor position
scancode_escapescescS7Escape for scancode emulation
scroll_forwardindsfScroll text up
scroll_reverserisrScroll text down
select_char_setscsZjSelect character set
set0_des_seqs0dss0Shift into codeset 0 (EUC set 0, ASCII)
set1_des_seqs1dss1Shift into codeset 1
set2_des_seqs2dss2Shift into codeset 2
set3_des_seqs3dss3Shift into codeset 3
set_a_attributessgr1Define second set of video attributes #1-#6
set_a_backgroundsetabABSet background color to #1 using ANSI escape
set_a_foregroundsetafAFSet foreground color to #1 using ANSI escape
set_attributessgrsaDefine first set of video attributes #1-#9
set_backgroundsetbSbSet background color to #1
set_bottom_marginsmgbZkSet bottom margin at current line
set_bottom_margin_parmsmgbpZlSet bottom margin at line #1 or #2 lines from bottom
set_clocksclkSCSet clock to hours (#1), minutes (#2), seconds (#3)
set_color_bandsetcolorYzChange to ribbon color #1
set_color_pairscpspSet current color pair to #1
set_foregroundsetfSfSet foreground color to #1
set_left_marginsmglMLSet left margin at current column
set_left_margin_parmsmglpZmSet left (right) margin at column #1 (#2)
set_lr_marginsmglrMLSets both left and right margins
set_page_lengthslinesYZSet page length to #1 lines
set_pglen_inchslengthYISet page length to #1 hundredth of an inch
set_right_marginsmgrMRSet right margin at current column
set_right_margin_parmsmgrpZnSet right margin at column #1
set_tabhtsstSet a tab in all rows, current column
set_tb_marginsmgtbMTSets both top and bottom margins
set_top_marginsmgtZoSet top margin at current line
set_top_margin_parmsmgtpZpSet top (bottom) margin at line #1 (#2)
set_windowwindwiCurrent window is lines #1-#2 cols #3-#4
start_bit_imagesbimZqStart printing bit image graphics
start_char_set_defscsdZrStart definition of a character set
stop_bit_imagerbimZsEnd printing bit image graphics
stop_char_set_defrcsdZtEnd definition of a character set
subscript_characterssubcsZuList of "subscript-able" characters
superscript_characterssupcsZvList of "superscript-able" characters
tabhttaTab to next 8-space hardware tab stop
these_cause_crdocrZwPrinting any of these chars causes cr
to_status_linetsltsGo to status line, col #1
tonetoneTOSelect touch tone dialing
user0u0u0User string 0
user1u1u1User string 1
user2u2u2User string 2
user3u3u3User string 3
user4u4u4User string 4
user5u5u5User string 5
user6u6u6User string 6
user7u7u7User string 7
user8u8u8User string 8
user9u9u9User string 9
underline_charucucUnderscore one char and move past it
up_half_linehuhuHalf-line up (reverse 1/2 line feed)
wait_tonewaitWAWait for dial tone
xoff_characterxoffcXFXOFF character
xon_characterxoncXNXON character
zero_motionzeromZxNo motion for the subsequent character

Sample Entry

The following entry describes the AT&T 610 terminal. (The pfxl and sgr values have been split for printing; they would actually be entered as single lines.)

610|610bct|ATT610|att610|AT&T610;80column;98key keyboard, am, eslok, hs, mir, msgr, xenl, xon, cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=\t, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, .ind=\ED$<9>, invis=\E[8m, is1=\E[8;0 | \E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0, is2=\E[0m^O, is3=\E(B\E)0, kLFT=\E[\s@, kRIT=\E[\sA, kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kfP=\EOc, kfP0=\ENp, kfP1=\ENq, kfP2=\ENr, kfP3=\ENs, kfP4=\ENt, kfI=\EOd, kfB=\EOe, kf4=\EOf, kf(CW=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, kind=\E[S, kri=\E[T, ll=\E[24H, mc4=\E[?4i, mc5=\E[?5i, nel=\EE, pfxl=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t\s\s\sF%p1%1d \s\s\s\s\s\s\s\s\s\s\s%;%p2%s, pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l, sc=\E7, sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1% |%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, sgr0=\E[m^O, smacs=^N, smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx,

Types of Capabilities in the Sample Entry

The sample entry shows the formats for the three types of terminfo capabilities: boolean, numeric, and string. All capabilities specified in the terminfo source file must be followed by commas, including the last capability in the source file. In terminfo source files, capabilities are referenced by their capability names (as shown in the Capname column of the previous tables).

Boolean Capabilities

A boolean capability is true if its Capname is present in the entry, and false if its Capname is not present in the entry.

The "@" character following a Capname is used to explicitly declare that a boolean capability is false, in situations described in the Similar Terminals subsection of the Insert/Delete Line section below.

Numeric Capabilities

Numeric capabilities are followed by the character "#" and then a positive integer value. The example assigns the value 80 to the cols numeric capability by coding:

  • cols#80

Values for numeric capabilities may be specified in decimal, octal or hexadecimal, using normal C-language conventions.

String Capabilities

String-valued capabilities such as el (clear to end of line sequence) are listed by the Capname, an "=", and a string ended by the next occurrence of a comma.

A delay in milliseconds may appear anywhere in such a capability, preceded by "$" and enclosed in angle brackets, as in el=\EK$<3>. The Curses implementation achieves delays by outputting to the terminal an appropriate number of system-defined padding characters. The tputs() function provides delays when used to send such a capability to the terminal.

The delay can be any of the following: a number; a number followed by an asterisk, such as 5*; a number followed by a slash, such as 5/; or a number followed by both, such as 5*/.

*

Shows that the required delay is proportional to the number of lines affected by the operation, and the amount given is the delay required per affected unit. (In the case of insert characters, the factor is still the number of lines affected. This is always 1 unless the device has in and the software uses it.) When a "*" is specified, it is sometimes useful to give a delay of the form 3.5 to specify a delay per unit to tenths of milliseconds. (Only one decimal place is allowed.)

/

Indicates that the delay is mandatory and padding characters are transmitted regardless of the setting of xon. If "/" is not specified or if a device has xon defined, the delay information is advisory and is only used for cost estimates or when the device is in raw mode. However, any delay specified for bel or flash is treated as mandatory.

The following notation is valid in terminfo source files for specifying special characters:

NotationRepresents Character
^xControl-x (for any appropriate x)
\aAlert
\bBackspace
\E or \eAn ESCAPE character
\fForm feed
\lLinefeed
\nNewline
\rCarriage return
\sSpace
\tTab
\^Caret (^)
\\Backslash (\)
\,Comma (,)
\:Colon (:)
\0Null
\nnnAny character, specified as three octal digits

(See the "X/Open System Interface Definitions, Issue 4, Version 2" specification, "General Terminal Interface".)

Commented-Out Capabilities

Sometimes individual capabilities must be commented out. To do this, put a period before the capability name. For example, see the second ind in the example in the Sample Entry section above. Note that capabilities are defined in a left-to-right order and, therefore, a prior definition will override a later definition.

Device Capabilities

Basic Capabilities

The number of columns on each line for the device is given by the cols numeric capability. If the device has a screen, then the number of lines on the screen is given by the lines capability. If the device wraps around to the beginning of the next line when it reaches the right margin, then it should have the am capability. If the terminal can clear its screen, leaving the cursor in the home position, then this is given by the clear string capability. If the terminal overstrikes (rather than clearing a position when a character is struck over) then it should have the os capability. If the device is a printing terminal, with no soft copy unit, specify both hc and os. If there is a way to move the cursor to the left edge of the current row, specify this as cr. (Normally this will be carriage return, control-M.) If there is a way to produce an audible signal (such as a bell or a beep), specify it as bel. If, like most devices, the device uses the XON/XOFF flow-control protocol, specify xon.

If there is a way to move the cursor one position to the left (such as backspace), that capability should be given as cub1. Similarly, sequences to move to the right, up, and down should be given as cuf1, cuu1, and cud1, respectively. These local cursor motions must not alter the text they pass over; for example, you would not normally use "cuf1=\s" because the space would erase the character moved over.

A very important point here is that the local cursor motions encoded in terminfo are undefined at the left and top edges of a screen terminal. Programs should never attempt to backspace around the left edge, unless bw is specified, and should never attempt to go up locally off the top. To scroll text up, a program goes to the bottom left corner of the screen and sends the ind (index) string. To scroll text down, a program goes to the top left corner of the screen and sends the ri (reverse index) string. The strings ind and ri are undefined when not on their respective corners of the screen.

Parameterized versions of the scrolling sequences are indn and rin. These versions have the same semantics as ind and ri, except that they take one argument and scroll the number of lines specified by that argument. They are also undefined except at the appropriate edge of the screen.

The am capability tells whether the cursor sticks at the right edge of the screen when text is output, but this does not necessarily apply to a cuf1 from the last column. Backward motion from the left edge of the screen is possible only when bw is specified. In this case, cub1 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 device has switch-selectable automatic margins, am should be specified in the terminfo source file. In this case, initialization strings should turn on this option, if possible. If the device has a command that moves to the first column of the next line, that command can be given as nel (newline). It does not matter if the command clears the remainder of the current line, so if the device has no cr and lf it may still be possible to craft a working nel out of one or both of them.

These capabilities suffice to describe hardcopy and screen terminals. Thus the AT&T 5320 hardcopy terminal is described as follows:

5320|att5320|AT&T 5320 hardcopy terminal, am, hc, os, cols#132, bel=^G, cr=\r, cub1=\b, cnd1=\n, dch1=\E[P, dl1=\E[M, ind=\n,

while the Lear Siegler ADM-3 is described as

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

Parameterized Strings

Cursor addressing and other strings requiring arguments are described by a argumentized string capability with escapes in a form (%x) comparable to printf() (see printf(1)). For example, to address the cursor, the cup capability is given, using two arguments: the row and column to address to. (Rows and columns are numbered from zero and refer to the physical screen visible to the user, not to any unseen memory.) If the terminal has memory relative cursor addressing, that can be indicated by mrcup.

The argument mechanism uses a stack and special "%" codes to manipulate the stack in the manner of Reverse Polish Notation (postfix). Typically a sequence pushes one of the arguments onto the stack and then prints it in some format. Often more complex operations are necessary. Operations are in postfix form with the operands in the usual order. That is, to subtract 5 from the first argument, one would use %p1%{5}%-.

The "%" encodings have the following meanings:

%%

Outputs "%".

%[[:]flags][width[.precision]][doxXs]

As in printf(); flags are [-+#] and space.

%c

Print pop() gives %c.

%p[1-9]

Push the ith argument.

%P[a-z]

Set dynamic variable [a-z] to pop().

%g[a-z]

Get dynamic variable [a-z] and push it.

%P[A-Z]

Set static variable [a-z] to pop().

%g[A-Z]

Get static variable [a-z] and push it.

%'c'

Push char constant c.

%{nn}

Push decimal constant nn.

%l

Push strlen(pop()).

%+ %- %* %/ %m

Arithmetic (%m is mod): push(pop integer2 op pop integer1) where integer1 represents the top of the stack

%& %| %^

Bit operations: push(pop integer2 op pop integer1)

%= %> %<

Logical operations: push(pop integer2 op pop integer1)

%A %O

Logical operations: and, or

%! %~

Unary operations: push(op pop())

%i

(For ANSI terminals) add 1 to the first argument (if one argument present), or first two arguments (if more than one argument present).

%? expr %t thenpart %e elsepart %;

If-then-else; %e elsepart is optional; else-if's are possible as in Algol 68:

%? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e b5 %;

ci are conditions; bi are bodies.

If the "-" flag is used with "%[doxXs]", then a colon must be placed between the "%" and the "-" to differentiate the flag from the binary "%-" operator. For example: "%:-16.16s".

Consider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needs to be sent \E&a12c03Y padded for 6 milliseconds. Note that the order of the rows and columns is inverted here, and that the row and column are zero-padded as two digits. Thus, its cup capability is:

  • cup=\E&a%p2%2.2dc%p1%2.2dY$<6>

The Micro-Term ACT-IV needs the current row and column sent preceded by a ^T, with the row and column simply encoded in binary:

  • cup=^T%p1%c%p2%c

Devices 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, as the system may change or discard them. (The library functions dealing with terminfo set tty modes so that tabs are never expanded, so \t is safe to send. This turns out to be essential for the Ann Arbor 4080.)

A final example is the LSI ADM-3a, which uses row and column offset by a blank character, thus:

  • cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c

After sending "\E=", this pushes the first argument, pushes the ASCII decimal 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 argument. 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 to (0,0): to the top left corner of the screen, not of memory. (Thus, the \EH sequence on Hewlett-Packard terminals cannot be used for home without losing some of the other features on the terminal.)

If the device has row or column absolute-cursor addressing, these can be given as single argument capabilities hpa (horizontal position absolute) and vpa (vertical position absolute). Sometimes these are shorter than the more general two-argument sequence (as with the Hewlett-Packard 2645) and can be used in preference to cup. If there are argumentized local motions (such as "move n spaces to the right"), these can be given as cud, cub, cuf, and cuu with a single argument indicating how many spaces to move. These are primarily useful if the device does not have cup, such as the Tektronix 4025.

If the device needs to be in a special mode when running a program that uses these capabilities, the codes to enter and exit this mode can be given as smcup and rmcup. This arises, for example, from terminals, such as the Concept, with more than one page of memory. If the device has only memory relative cursor addressing and not screen relative cursor addressing, a one screen-sized window must be fixed into the device for cursor addressing to work properly. This is also used for the Tektronix 4025, where smcup sets the command character to be the one used by terminfo. If the rmcup sequence will not restore the screen after an smcup sequence is output (to the state prior to outputting smcup), specify nrrmc.

Area Clears

If the terminal can clear from the current position to the end of the line, leaving the cursor where it is, this should be given as el. If the terminal can clear from the beginning of the line to the current position inclusive, leaving the cursor where it is, this should be given as el1. If the terminal can clear from the current position to the end of the display, then this should be given as ed. ed is only defined from the first column of a line. (Thus, it can be simulated by a request to delete a large number of lines, if a true ed is not available.)

Insert/Delete Line

If the terminal can open a new blank line before the line where the cursor is, this should be given as il1; this is done only from the first position of a line. The cursor must then appear on the newly blank line. If the terminal can delete the line which the cursor is on, then this should be given as dl1; this is done only from the first position on the line to be deleted. Versions of il1 and dl1 which take a single argument and insert or delete that many lines can be given as il and dl.

If the terminal has a settable destructive scrolling region (like the VT100) the command to set this can be described with the csr capability, which takes two arguments: the top and bottom lines of the scrolling region. The cursor position is, alas, undefined after using this command. It is possible to get the effect of insert or delete line using this command — the sc and rc (save and restore cursor) commands are also useful. Inserting lines at the top or bottom of the screen can also be done using ri or ind on many terminals without a true insert/delete line, and is often faster even on terminals with those features.

To determine whether a terminal has destructive scrolling regions or nondestructive scrolling regions, create a scrolling region in the middle of the screen, place data on the bottom line of the scrolling region, move the cursor to the top line of the scrolling region, and do a reverse index (ri) followed by a delete line (dl1) or index (ind). If the data that was originally on the bottom line of the scrolling region was restored into the scrolling region by the dl1 or ind, then the terminal has nondestructive scrolling regions. Otherwise, it has destructive scrolling regions. Do not specify csr if the terminal has nondestructive scrolling regions, unless ind, ri, indn, rin, dl, and dl1 all simulate destructive scrolling.

If the terminal has the ability to define a window as part of memory, which all commands affect, it should be given as the argumentized string wind. The four arguments are the starting and ending lines in memory and the starting and ending columns in memory, in that order.

If the terminal can retain display memory above, then the da capability should be given; if display memory can be retained below, then db should be given. These indicate that deleting a line or scrolling a full screen may bring nonblank lines up from below or that scrolling back with ri may bring down nonblank lines.

Insert/Delete Character

There are two basic kinds of intelligent terminals with respect to insert/delete character operations which can be described using terminfo. The most common insert/delete character operations affect only the characters on the current line and shift characters off the end of the line rigidly. Other terminals, such as the Concept 100 and the Perkin-Elmer Owl, make a distinction between typed and untyped blanks on the screen, shifting upon an insert or delete only to an untyped blank on the screen which is either eliminated, or expanded to two untyped blanks. You can determine the kind of terminal you have by clearing the screen and then typing text separated by cursor motions. Type "abc def" using local cursor motions (not spaces) between the abc and the def. Then position the cursor before the abc and put the terminal in insert mode. If typing characters causes the rest of the line to shift rigidly and characters to fall off the end, then your terminal does not distinguish between blanks and untyped positions. If the abc shifts over to the def which then move together around the end of the current line and onto the next as you insert, you have the second type of terminal, and should give the capability in, which stands for "insert null". While these are two logically separate attributes (one line versus multiline insert mode, and special treatment of untyped spaces) we have seen no terminals whose insert mode cannot be described with the single attribute.

terminfo can describe both terminals that have an insert mode and terminals which send a simple sequence to open a blank position on the current line. Give as smir the sequence to get into insert mode. Give as rmir the sequence to leave insert mode. Now give as ich1 any sequence needed to be sent just before sending the character to be inserted. Most terminals with a true insert mode will not give ich1; terminals that send a sequence to open a screen position should give it here. (If your terminal has both, insert mode is usually preferable to ich1. Do not give both unless the terminal requires both to be used in combination.) If post-insert padding is needed, give this as a number of milliseconds padding in ip (a string option). Any other sequence which may need to be sent after an insert of a single character may also be given in ip. If your terminal needs both to be placed into an "insert mode" and a special code to precede each inserted character, then both smir/rmir and ich1 can be given, and both will be used. The ich capability, with one argument, n, will insert n blanks.

If padding is necessary between characters typed while not in insert mode, give this as a number of milliseconds padding in rmp.

It is occasionally necessary to move around while in insert mode to delete characters on the same line (for example, if there is a tab after the insertion position). If your terminal allows motion while in insert mode you can give the capability mir to speed up inserting in this case. Omitting mir will affect only speed. Some terminals (notably Datamedia) must not have mir because of the way their insert mode works.

Finally, you can specify dch1 to delete a single character, dch with one argument, n, to delete n characters, and delete mode by giving smdc and rmdc to enter and exit delete mode (any mode the terminal needs to be placed in for dch1 to work).

A command to erase n characters (equivalent to outputting n blanks without moving the cursor) can be given as ech with one argument.

Highlighting, Underlining, and Visible Bells

Your device may have one or more kinds of display attributes that allow you to highlight selected characters when they appear on the screen. The following display modes (shown with the names by which they are set) may be available:

  • A blinking screen (blink)

  • Bold or extra-bright characters (bold)

  • Dim or half-bright characters (dim)

  • Blanking or invisible text (invis)

  • Protected text (prot)

  • A reverse-video screen (rev)

  • An alternate character set (smacs to enter this mode and rmacs to exit it). (If a command is necessary before you can enter alternate character set mode, give the sequence in enacs or "enable alternate-character-set" mode.) Turning on any of these modes singly may turn off other modes.

sgr0 should be used to turn off all video enhancement capabilities. It should always be specified because it represents the only way to turn off some capabilities, such as dim or blink.

Choose one display method as standout mode and use it to highlight error messages and other text to which you want to draw attention. Choose a form of display that provides strong contrast but that is easy on the eyes. (We recommend reverse-video plus half-bright or reverse-video alone.) The sequences to enter and exit standout mode are given as smso and rmso, respectively. If the code to change into or out of standout mode leaves one or even two blank spaces on the screen, as the TVI 912 and Teleray 1061 do, then xmc should be given to tell how many spaces are left.

Sequences to begin underlining and end underlining can be specified as smul and rmul, respectively. If the device has a sequence to underline the current character and to move the cursor one space to the right (such as the Micro-Term MIME), this sequence can be specified as uc.

Terminals with the "magic cookie" glitch (xmc) deposit special "cookies" when they receive mode-setting sequences, which affect the display algorithm rather than having extra bits for each character. Some terminals, such as the Hewlett-Packard 2621, automatically leave standout mode when they move to a new line or the cursor is addressed. Programs using standout mode should exit standout mode before moving the cursor or sending a newline, unless the msgr capability, asserting that it is safe to move in standout mode, is present.

If the terminal has a way of flashing the screen to indicate an error quietly (a bell replacement), then this can be given as flash; it must not move the cursor. A good flash can be done by changing the screen into reverse video, pad for 200 ms, then return the screen to normal video.

If the cursor needs to be made more visible than normal when it is not on the bottom line (to make, for example, a nonblinking underline into an easier to find block or blinking underline) give this sequence as cvvis. The boolean chts should also be given. If there is a way to make the cursor completely invisible, give that as civis. The capability cnorm should be given, which undoes the effects of either of these modes.

If your terminal generates underlined characters by using the underline character (with no special sequences needed) even though it does not otherwise overstrike characters, then specify the capability ul. For devices on which a character overstriking another leaves both characters on the screen, specify the capability os. If overstrikes are erasable with a blank, then this should be indicated by specifying eo.

If there is a sequence to set arbitrary combinations of modes, this should be given as sgr (set attributes), taking nine arguments. Each argument is either 0 or nonzero, as the corresponding attribute is on or off. The nine arguments are, in order: standout, underline, reverse, blink, dim, bold, blank, protect, alternate character set. Not all modes need to be supported by sgr; only those for which corresponding separate attribute commands exist should be supported. For example, let's assume that the terminal in question needs the following escape sequences to turn on various modes.

tparm()  
ArgumentAttributeEscape Sequence
none\E[0m
p1standout\E[0;4;7m
p2underline\E[0;3m
p3reverse\E[0;4m
p4blink\E[0;5m
p5dim\E[0;7m
p6bold\E[0;3;4m
p7invis\E[0;8m
p8protectnot available
p9altcharset^O (off) ^N (on)

Note that each escape sequence requires a 0 to turn off other modes before turning on its own mode. Also note that, as suggested above, standout is set up to be the combination of reverse and dim. Also, because this terminal has no bold mode, bold is set up as the combination of reverse and underline. In addition, to allow combinations, such as underline+blink, the sequence to use would be \E[0;3;5m. The terminal doesn't have protect mode, either, but that cannot be simulated in any way, so p8 is ignored. The altcharset mode is different in that it is either ^O or ^N, depending on whether it is off or on. If all modes were to be turned on, the sequence would be:

  • \E[0;3;4;5;7;8m^N

Now look at when different sequences are output. For example, ;3 is output when either p2 or p6 is true, that is, if either underline or bold modes are turned on. Writing out the above sequences, along with their dependencies, gives the following:

SequenceWhen to Outputterminfo Translation
\E[0always\E[0
;3if p2 or p6%?%p2%p6%|%t;3%;
;4if p1 or p3 or p6%?%p1%p3%|%p6%|%t;4%;
;5if p4%?%p4%t;5%;
;7if p1 or p5%?%p1%p5%|%t;7%;
;8if p7%?%p7%t;8%;
malwaysm
^N or ^Oif p9, ^N; else ^O%?%p9%t^N%e^O%;

Putting this all together into the sgr sequence gives:

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

Remember that sgr and sgr0 must always be specified.

Keypad

If the device has a keypad that transmits sequences when the keys are pressed, this information can also be specified. Note that it is not possible to handle devices where the keypad only works in local (this applies, for example, to the unshifted Hewlett-Packard 2621 keys). If the keypad can be set to transmit or not transmit, specify these sequences as smkx and rmkx. Otherwise the keypad is assumed to always transmit.

The sequences sent by the left arrow, right arrow, up arrow, down arrow, and home keys can be given as kcub1, kcuf1, kcuu1, kcud1 and khome, respectively. If there are function keys such as f0, f1, ..., f63, the sequences they send can be specified as kf0, kf1, ..., kf63. If the first 11 keys have labels other than the default f0 through f10, the labels can be given as lf0, lf1, ..., lf10.

The codes transmitted by certain other special keys can be given: kll (home down), kbs (backspace), ktbc (clear all tabs), kctab (clear the tab stop in this column), kclr (clear screen or erase key), kdch1 (delete character), kdl1 (delete line), krmir (exit insert mode), kel (clear to end of line), ked (clear to end of screen), kich1 (insert character or enter insert mode), kil1 (insert line), knp (next page), kpp (previous page), kind (scroll forward/down), kri (scroll backward/up), khts (set a tab stop in this column). In addition, if the keypad has a 3 by 3 array of keys including the four arrow keys, the other five keys can be given as ka1, ka3, kb2, kc1, and kc3. These keys are useful when the effects of a 3 by 3 directional pad are needed. Further keys are defined above in the capabilities list.

Strings to program function keys can be specified as pfkey, pfloc, and pfx. A string to program screen labels should be specified as pln. Each of these strings takes two arguments: a function key identifier and a string to program it with. 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. The capabilities nlab, lw and lh define the number of programmable screen labels and their width and height. If there are commands to turn the labels on and off, give them in smln and rmln. smln is normally output after one or more pln sequences to make sure that the change becomes visible.

Tabs and Initialization

If the device has hardware tabs, the command to advance to the next tab stop can be given as ht (usually control-I). A "backtab" command that moves leftward to the next tab stop can be given as cbt. By convention, if tty modes show that tabs are being expanded by the computer rather than being sent to the device, programs should not use ht or cbt (even if they are present) because the user might not have the tab stops properly set. If the device has hardware tabs that are initially set every n spaces when the device is powered up, the numeric argument it is given, showing the number of spaces the tabs are set to. This is normally used by tput init to determine whether to set the mode for hardware tab expansion and whether to set the tab stops. If the device has tab stops that can be saved in nonvolatile memory, the terminfo description can assume that they are properly set. If there are commands to set and clear tab stops, they can be given as tbc (clear all tab stops) and hts (set a tab stop in the current column of every row).

Other capabilities include: is1, is2, and is3, initialization strings for the device; iprog, the path name of a program to be run to initialize the device; and if, the name of a file containing long initialization strings. These strings are expected to set the device into modes consistent with the rest of the terminfo description. They must be sent to the device each time the user logs in and be output in the following order: run the program iprog; output is1; output is2; set the margins using mgc, smgl and smgr; set the tabs using tbc and hts; print the file if; and finally output is3. This is usually done using the init option of tput.

Most initialization is done with is2. Special device modes can be set up without duplicating strings by putting the common sequences in is2 and special cases in is1 and is3. Sequences that do a reset from a totally unknown state can be given as rs1, rs2, rf, and rs3, analogous to is1, is2, is3, and if. (The method using files, if and rf, is used for a few terminals; however, the recommended method is to use the initialization and reset strings.) These strings are output by tput reset, which is used when the terminal gets into a wedged state. Commands are normally placed in rs1, rs2, rs3, and rf only if they produce annoying effects on the screen and are not necessary when logging in. For example, the command to set a terminal into 80-column mode would normally be part of is2, but on some terminals it causes an annoying glitch on the screen and is not normally needed because the terminal is usually already in 80-column mode.

If a more complex sequence is needed to set the tabs than can be described by using tbc and hts, the sequence can be placed in is2 or if.

Any margin can be cleared with mgc. (For instructions on how to specify commands to set and clear margins, see the Margins subsection of the Capabilities That Cause Movement section below.

Delays

Certain capabilities control padding in the tty driver. These are primarily needed by hard-copy terminals, and are used by tput init to set tty modes appropriately (see tput(1)). Delays embedded in the capabilities cr, ind, cub1, ff, and tab can be used to set the appropriate delay bits to be set in the tty driver. If pb (padding baud rate) is given, these values can be ignored at baud rates below the value of pb.

Status Lines

If the terminal has an extra "status line" that is not normally used by software, this fact can be indicated. If the status line is viewed as an extra line below the bottom line, into which one can cursor-address normally (such as the Heathkit H19's 25th line, or the 24th line of a VT100 which is set to a 23-line scrolling region), the capability hs should be given. Special strings that go to a given column of the status line and return from the status line can be given as tsl and fsl. (fsl must leave the cursor position in the same place it was before tsl. If necessary, the sc and rc strings can be included in tsl and fsl to get this effect.) The capability tsl takes one argument, which is the column number of the status line the cursor is to be moved to.

If escape sequences and other special commands, such as tab, work while in the status line, the flag eslok can be given. A string which turns off the status line (or otherwise erases its contents) should be given as dsl. If the terminal has commands to save and restore the position of the cursor, give them as sc and rc. The status line is normally assumed to be the same width as the rest of the screen (that is, 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 argument wsl.

Line Graphics

If the device has a line drawing alternate character set, the mapping of glyph to character would be given in acsc. The definition of this string is based on the alternate character set used in the Digital VT100 terminal, extended slightly with some characters from the AT&T 4410v1 terminal.

 VT100+
Glyph NameCharacter
arrow pointing right+
arrow pointing left,
arrow pointing down.
solid square block0
lantern symbolI
arrow pointing up-
diamond`
checker board (stipple)a
degree symbolf
plus/minusg
board of squaresh
lower right cornerj
upper right cornerk
upper left cornerl
lower left cornerm
plusn
scan line 1o
horizontal lineq
scan line 9s
left teet
right teeu
bottom teev
top teew
vertical linex
bullet~

The best way to describe a new device's line graphics set is to add a third column to the above table with the characters for the new device that produce the appropriate glyph when the device is in alternate-character-set mode. For example:

 VT100+Character Used
Glyph NameCharacteron New Device
upper left cornerlR
lower left cornermF
upper right cornerkT
lower right cornerjG
horizontal lineq,
vertical linex.

Now write down the characters left to right; for example:

acsc=lRmFkTjGq\,x.

In addition, terminfo lets you define multiple character sets (see the Alternate Character Sets section below).

Color Manipulation

Most color terminals belong to one of two classes of terminal:

  • Tektronix-style

    The Tektronix method uses a set of N predefined colors (usually 8) from which an application can select "current" foreground and background colors. Thus a terminal can support up to N colors mixed into N*N color-pairs to be displayed on the screen at the same time.

  • Hewlett-Packard-style

    In the HP method, the application cannot define the foreground independently of the background, or vice-versa. Instead, the application 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 can be displayed on the screen at the same time. If a terminal can change the definition of a color (for example, the Tektronix 4100 and 4200 series terminals), this should be specified with ccc (can change color). To change the definition of a color (Tektronix 4200 method), use initc (initialize color). It requires four arguments: color number (ranging from 0 to colors-1) and three RGB (red, green, and blue) values or three HLS colors (Hue, Lightness, Saturation). Ranges of RGB and HLS values are terminal-dependent.

Tektronix 4100 series terminals only use HLS color notation. For such terminals (or dual-mode terminals to be operated in HLS mode) one must define a boolean variable hls; that would instruct the init_color() function (see can_change_color(3X)) to convert its RGB arguments to HLS before sending them to the terminal. The last three arguments to the initc string would then be HLS values.

If a terminal can change the definitions of colors, but uses a color notation different from RGB and HLS, a mapping to either RGB or HLS must be developed.

If the terminal supports ANSI escape sequences to set background and foreground, they should be coded as setab and setaf, respectively. If the terminal supports other escape sequences to set background and foreground, they should be coded as setb and setf, respectively. The vidputs() function (see vidattr(3X)) and the refresh functions use setab and setaf if they are defined. Each of these capabilities requires one argument: the number of the color. By convention, the first eight colors (0-7) map to, in order: black, red, green, yellow, blue, magenta, cyan, white. However, color re-mapping may occur or the underlying hardware may not support these colors. Mappings for any additional colors supported by the device (that is, to numbers greater than 7) are at the discretion of the terminfo entry writer.

To initialize a color-pair (HP method), use initp (initialize pair). It requires seven arguments: the number of a color-pair (range=0 to pairs-1), and six RGB values: three for the foreground followed by three for the background. (Each of these groups of three should be in the order RGB.) When initc or initp are used, RGB or HLS arguments should be in the order "red, green, blue" or "hue, lightness, saturation"), respectively. To make a color-pair current, use scp (set color-pair). It takes one argument, the number of a color-pair.

Some terminals (for example, most color terminal emulators for PCs) erase areas of the screen with current background color. In such cases, bce (background color erase) should be defined. The variable op (original pair) contains a sequence for setting the foreground and the background colors to what they were at the terminal start-up time. Similarly, oc (original colors) contains a control sequence for setting all colors (for the Tektronix method) or color-pairs (for the HP method) 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. Information about these video attributes should be packed into the ncv (no color video) variable. 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.

 BitDecimalCharacteristic
AttributePositionValueThat Sets
WA_STANDOUT01sgr, parameter 1
WA_UNDERLINE12sgr, parameter 2
WA_REVERSE24sgr, parameter 3
WA_BLINK38sgr, parameter 4
WA_DIM416sgr, parameter 5
WA_BOLD532sgr, parameter 6
WA_INVIS664sgr, parameter 7
WA_PROTECT7128sgr, parameter 8
WA_ALTCHARSET8256sgr, parameter 9
WA_HORIZONTAL9512sgr1, parameter 1
WA_LEFT101024sgr1, parameter 2
WA_LOW112048sgr1, parameter 3
WA_RIGHT124096sgr1, parameter 4
WA_TOP138192sgr1, parameter 5
WA_VERTICAL1416384sgr1, parameter 6

When a particular video attribute should not be used with colors, set the corresponding ncv bit to 1; otherwise set it to 0. To determine the information to pack into the ncv variable, add the decimal values corresponding to those attributes that cannot coexist with colors. For example, if the terminal uses colors to simulate reverse video (bit number 2 and decimal value 4) and bold (bit number 5 and decimal value 32), the resulting value for ncv will be 36 (4 + 32).

Miscellaneous

If the terminal requires other than a null (zero) character as a pad, then this can be given as pad. Only the first character of the pad string is used. If the terminal does not have a pad character, specify npc.

If the terminal can move up or down half a line, this can be indicated with hu (half-line up) and hd (half-line down). This is primarily useful for superscripts and subscripts on hardcopy terminals. If a hardcopy terminal can eject to the next page (form feed), give this as ff (usually control-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 argumentized string rep. The first argument is the character to be repeated and the second is the number of times to repeat it. Thus, tparm(repeat_char, 'x', 10) is the same as xxxxxxxxxx.

If the terminal has a settable command character, such as the Tektronix 4025, this can be indicated with cmdch. A prototype command character is chosen which is used in all capabilities. This character is given in the cmdch capability to identify it. The following convention is supported on some systems: If the environment variable CC exists, all occurrences of the prototype character are replaced with the character in CC.

Terminal descriptions that do not represent a specific kind of known terminal, such as switch, dialup, patch, and network, should include the gn (generic) capability so that programs can complain that they do not know how to talk to the terminal. (This capability does not apply to virtual terminal descriptions for which the escape sequences are known.) If the terminal is one of those supported by the virtual terminal protocol, the terminal number can be given as vt. A line-turn-around sequence to be transmitted before doing reads should be specified in rfi.

If the device uses XON/XOFF handshaking for flow control, give xon. Padding information should still be included so that functions can make better decisions about costs, but actual pad characters will not be transmitted. Sequences to turn on and off XON/XOFF handshaking may be given in smxon and rmxon. If the characters used for handshaking are not ^S and ^Q, they may be specified with xonc and xoffc.

If the terminal has a "meta key" which acts as a shift key, setting the 8th bit of any character transmitted, this fact can be indicated with km. Otherwise, software will assume that the 8th bit is parity and it will usually be cleared. If strings exist to turn this "meta mode" on and off, they can be given as smm and rmm.

If the terminal has more lines of memory than will fit on the screen at once, the number of lines of memory can be indicated with lm. A value of lm#0 indicates that the number of lines is not fixed, but that there is still more memory than fits on the screen.

Media copy strings which control an auxiliary printer connected to the terminal can be given as:

mc0

Print the contents of the screen.

mc4

Turn off the printer.

mc5

Turn on the printer.

When the printer is on, all text sent to the terminal will be sent to the printer. A variation, mc5p, takes one argument, and leaves the printer on for as many characters as the value of the argument, then turns the printer off. The argument should not exceed 255. If the text is not displayed on the terminal screen when the printer is on, specify mc5i (silent printer). All text, including mc4, is transparently passed to the printer while an mc5p is in effect.

Special Cases

The working model used by terminfo fits most terminals reasonably well. However, some terminals do not completely match that model, requiring special support by terminfo. These are not meant to be construed as deficiencies in the terminals; they are just differences between the working model and the actual hardware. They may be unusual devices or, for some reason, do not have all the features of the terminfo model implemented.

Terminals that cannot display tilde (~) characters, such as certain Hazeltine terminals, should indicate hz.

Terminals that ignore a line feed immediately after an am wrap, such as the Concept 100, should indicate xenl. Those terminals whose cursor remains on the right-most column until another character has been received, rather than wrapping immediately upon receiving the right-most character, such as the VT100, should also indicate xenl.

If el is required to get rid of standout (instead of writing normal text on top of it), xhp should be given.

Those Teleray terminals whose tabs turn all characters moved over to blanks, should indicate xt (destructive tabs). This capability is also taken to mean that it is not possible to position the cursor on top of a "magic cookie". Therefore, to erase standout mode, it is necessary, instead, to use delete and insert line.

For Beehive Superbee terminals that do not transmit the escape or control-C characters, specify xsb, indicating that the f1 key is to be used for escape and the f2 key for control-C.

Similar Terminals

If there are two similar terminals, one can be defined as being just like the other with certain exceptions. The string capability use can be given with the name of the similar terminal. The capabilities given before use override those in the terminal type invoked by use. A capability can be canceled by placing capability-name@ prior to the appearance of the string capability use. For example, the entry:

att4424-2|Teletype 4424 in display function group ii, rev@, sgr@, smul@, use=att4424,

defines an AT&T 04424 terminal that does not have the rev, sgr, and smul capabilities, and hence cannot do highlighting. This is useful for different modes for a terminal, or for different user preferences. More than one use capability may be given.

Printer Capabilities

The terminfo database lets you define capabilities of printers as well as terminals. Capabilities available for printers are included in the lists in the Defined Capabilities section above.

Rounding Values

Because argumentized string capabilities work only with integer values, terminfo designers should create strings that expect numeric values that have been rounded. Application designers should note this and should always round values to the nearest integer before using them with a argumentized string capability.

Printer Resolution

A printer's resolution is defined to be the smallest spacing of characters it can achieve. In general, the horizontal and vertical resolutions are independent. Thus the vertical resolution of a printer can be determined by measuring the smallest achievable distance between consecutive printing baselines, while the horizontal resolution can be determined by measuring the smallest achievable distance between the leftmost edges of consecutive printed, identical, characters.

All printers are assumed to be capable of printing with a uniform horizontal and vertical resolution. The view of printing that terminfo currently presents is one of printing 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. (The cell size can be changed as will be seen later.)

Many printers are capable of "proportional printing", where the horizontal spacing depends on the size of the character last printed. terminfo 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 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 or 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. Thus the old lines capability would give the length of a page in lines, and the cols capability would give 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 be concomitant with normal mode, so that all the capabilities work at the same time.

Specifying Printer Resolution

The printing resolution of a printer is given in several ways. Each specifies the resolution as the number of smallest steps per distance:

Characteristic Number of Smallest Steps
orhiSteps per inch horizontally
orviSteps per inch vertically
orcSteps per column
orlSteps per line

When printing in normal mode, each character printed causes movement 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 distance moved vertically 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.

Automatic Motion after Printing
Normal Mode:
orcSteps moved horizontally
orlSteps moved vertically
Micro Mode:
mcsSteps moved horizontally
mlsSteps moved vertically

Some printers are capable of printing 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 whether in normal mode or micro mode (mcs=orc), then the distance moved for a wide character is also the same whether in normal mode or micro mode. This doesn't mean the normal character distance is necessarily the same as the wide character distance, just that the distances don't change with a change in normal to micro mode. However, if the distance moved for a regular character is different in micro mode from the distance moved in normal mode (mcs<orc), the micro mode distance is assumed to be the same for a wide character printed in micro mode, as the table below shows.

Automatic Motion after Printing Wide Character
Normal Mode or Micro Mode (mcs = orc):
widcsSteps moved horizontally
Micro Mode (mcs < orc):
mcsSteps moved horizontally

There may be 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:

Changing the Character/Line Pitches
cpiChange character pitch
cpixIf set, cpi changes orhi; otherwise, changes orc
lpiChange line pitch
lpixIf set, lpi changes orvi; otherwise, changes orl
chrChange steps per column
cvrChange steps per line

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

Using any of the control sequences in these strings will imply a change in some of the values of orc, orhi, orl, and orvi. Also, the distance moved when a wide character is printed, widcs, changes in relation to orc. 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 cpi, lpi, chr, or cvr should recalculate the printer resolution (and should recalculate other values. See the Effect of Changing Printing Resolution section below.

Effects of Changing the Character/Line Pitches
BeforeAfter
Using cpi with cpix clear: 
orhi'orhi
orc'orc = orhi / Vcpi
Using cpi with cpix set: 
orhi'orhi = orc * Vcpi
orc'orc
Using lpi with lpix clear: 
orvi'orvi
orl'orl = orvi / Vlpi
Using lpi with lpix set: 
orvi'orvi = orl * Vlp
orl'orl
Using chr: 
orhi'orhi
orc'Vchr
Using cvr: 
orvi'orvi
orl'Vcvr
Using cpi or chr: 
widcs'widcs = widcs' * orc / orc'
mcs'mcs = mcs' * orc / orc'

Vchr, Vcpi, Vcvr, and Vlpi are the arguments used with chr, cpi, cvr, and lpi, respectively. The prime marks (') indicate the old values.

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.

terminfo 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 smallest steps.

String Capabilities for Motion
mcub1Move 1 step left
mcuf1Move 1 step right
mcuu1Move 1 step up
mcud1Move 1 step down
mcubMove N steps left
mcufMove N steps right
mcuuMove N steps up
mcudMove N steps down
mhpaMove N steps from the left
mvpaMove N steps from the top

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

Sometimes the motion is limited to less than the width or length of a page. Also, some printers don't accept absolute motion to the left of the current position. terminfo has capabilities for specifying these limits.

Limits to Motion
mjumpLimit on use of mcub1, mcuf1, mcuu1, mcud1
maddrLimit on use of mhpa, mvpa
xhpaIf set, hpa and mhpa can't move left
xvpaIf set, vpa and mvpa can't move up

If a printer needs to be in a "micro mode" for the motion capabilities described above to work, there are string capabilities defined to contain the control sequence to enter and exit this mode. A boolean is available for those printers where using a carriage return causes an automatic return to normal mode.

Entering/Exiting Micro Mode
smicmEnter micro mode
rmicmExit micro mode
crxmUsing cr 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. terminfo has boolean capabilities for describing all three cases.

What Happens After Character Printed in Rightmost Position
samAutomatic move to beginning of same line

Some printers can be put in a mode where the normal direction of motion is reversed. This mode can be especially useful when there are no capabilities for leftward or upward motion, because those capabilities can be built 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 in the terminfo database. This allows several reverse motions to be strung together without intervening wasted steps that leave and reenter reverse mode.

Entering/Exiting Reverse Modes
slmReverse sense of horizontal motions
rlmRestore sense of horizontal motions
sumReverse sense of vertical motions
rumRestore sense of vertical motions
While sense of horizontal motion is reversed:
mcub1Move 1 step right
mcuf1Move 1 step left
mcubMove N steps right
mcufMove N steps left
cub1Move 1 column right
cuf1Move 1 column left
cubMove N columns right
cufMove N columns left
While sense of vertical motion is reversed:
mcuu1Move 1 step down
mcud1Move 1 step up
mcuuMove N steps down
mcudMove N steps up
cuu1Move 1 line down
cud1Move 1 line up
cuuMove N lines down
cudMove N lines up

The reverse motion modes 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 experience motion to the beginning of the previous line when a character is printed in the rightmost position 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 motion capabilities. One of these is needed for printers that move the current position to the beginning of a line when certain control characters, such as line feed or form feed, are used. The other is used for the capability of suspending the motion that normally occurs after printing a character.

Miscellaneous Motion Strings
docrList of control characters causing cr
zeromPrevent auto motion after printing next single character

Margins

terminfo 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 require not using motion strings to move the current position to a margin and then fixing the margin there, but require the specification of where a margin should be regardless of the current position. Therefore terminfo offers six additional strings for defining margins with printers.

Setting Margins
smglSet left margin at current column
smgrSet right margin at current column
smgbSet bottom margin at current line
smgtSet top margin at current line
smgbpSet bottom margin at line N
smglpSet left margin at column N
smgrpSet right margin at column N
smgtpSet top margin at line N

The last four strings are used with one or more arguments that give the position of the margin or margins to set. If both of smglp and smgrp are set, each is used with a single argument, N, that gives the column number of the left and right margin, respectively. If both of smgtp and smgbp are set, each is used to set the top and bottom margin, respectively: smgtp is used with a single argument, N, the line number of the top margin; however, smgbp is used with two arguments, N and M, that give the line number of the bottom margin, the first counting from the top of the page and the second counting from the bottom. This accommodates the two styles of specifying the bottom margin in different manufacturers' printers. When coding a terminfo entry for a printer that has a settable bottom margin, only the first or second argument should be used, depending on the printer. When writing an application that uses smgbp to set the bottom margin, both arguments must be given.

If only one of smglp and smgrp is set, then it is used with two arguments, the column number of the left and right margins, in that order. Likewise, if only one of smgtp and smgbp is set, then it is used with two arguments that give the top and bottom margins, in that order, counting from the top of the page. Thus when coding a terminfo entry for a printer that requires setting both left and right or top and bottom margins simultaneously, only one of smglp and smgrp or smgtp and smgbp should be defined; the other should be left blank. When writing an application that uses these string capabilities, the pairs should be first checked to see if each in the pair is set or only one is set, and should then be used accordingly.

In counting lines or columns, line zero is the top line and column zero is the left-most column. A zero value for the second argument with smgbp means the bottom line of the page.

All margins can be cleared with mgc.

Shadows, Italics, Wide Characters, Superscripts, Subscripts

Five sets of strings describe the capabilities printers have of enhancing printed text.

Enhanced Printing
sshmEnter shadow-printing mode
rshmExit shadow-printing mode
sitmEnter italicizing mode
ritmExit italicizing mode
swidmEnter wide character mode
rwidmExit wide character mode
ssupmEnter superscript mode
rsupmExit superscript mode
supcsList of characters available as superscripts
ssubmEnter subscript mode
rsubmExit subscript mode
subcsList 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 rshm should use the sshm control sequence before every character to be shadow-printed; otherwise, the sshm control sequence should be used once before the set of characters to be shadow-printed, followed by rshm. The same is also true of each of the sitm-ritm, swidm-rwidm, ssupm-rsupm, and ssubm-rsubm pairs.

terminfo also has a capability for printing emboldened text (bold). 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 widcs.

If only a subset of the printable ASCII characters can be printed as superscripts or subscripts, they should be listed in supcs or subcs strings, 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. Thus, for example, printing any of the following three examples results in equivalent motion:

Bi Bi Bi

Note that the existing msgr boolean capability describes whether motion control sequences can be used while in "standout mode". This capability is extended to cover the enhanced printing modes added here. msgr should be set for those printers that accept any motion control sequences without affecting shadow, italicized, widened, superscript, or subscript printing. Conversely, if msgr 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 (described in the Line Graphics subsection of the Insert/Delete Character section above), terminfo lets you define alternate character sets. The following capabilities cover printers and terminals with multiple selectable or definable character sets:

Alternate Character Sets
scsSelect character set N
scsdStart definition of character set N, M characters
defcDefine character A, B dots wide, descender D
rcsdEnd definition of character set N
csnmList of character set names
daisyPrinter has manually changed print-wheels

The scs, rcsd, and csnm strings are used with a single argument, N, a number from 0 to 63 that identifies the character set. The scsd string is also used with the argument N and another, M, that gives the number of characters in the set. The defc string is used with three arguments: A gives the ASCII code representation for the character, B gives the width of the character in dots, and D is zero or one depending on whether the character is a "descender" or not. The defc string is also followed by a string of "image-data" bytes that describe how the character looks (see below).

Character set 0 is the default character set present after the printer has been initialized. Not every printer has 64 character sets, of course; using scs with an argument that doesn't select an available character set should cause a null pointer to be returned by tparm() (see tigetflag(3X)).

If a character set has to be defined before it can be used, the scsd control sequence is to be used before defining the character set, and the rcsd is to be used after. They should also cause a NULL pointer to be returned by tparm() when used with an argument N that doesn't apply. If a character set still has to be selected after being 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 tparm(), 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 covered by terminfo, the ASCII code 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 in dots is given, along with an indication of whether the character should descend below the print line (such as the lower case letter "g" in most character sets). The width of the character in 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 in the Dot-Matrix Graphics section below.

It's 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 string alleviates this problem by providing names for each number.

When used with a character set number in a call to tparm(), the csnm string will produce the equivalent name. These names should be used as a reference 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 string to determine the corresponding character set number.

These capabilities are likely to be used only with dot-matrix printers. If they are not available, the strings should not be defined. For printers that have manually changed print-wheels or font cartridges, the boolean daisy is set.

Dot-Matrix Graphics

Dot-matrix printers typically have the capability of reproducing raster graphics images. Three numeric capabilities and three string capabilities help a program draw raster-graphics images independent of the type of dot-matrix printer or the number of pins or dots the printer can handle at one time.

Dot-Matrix Graphics
npinsNumber of pins, N, in print-head
spinvSpacing of pins vertically in pins per inch
spinhSpacing of dots horizontally in dots per inch
porderMatches software bits to print-head pins
sbimStart printing bit image graphics, B bits wide
rbimEnd printing bit image graphics

The sbim string is used with a single argument, B, the width of the image in dots.

The model of dot-matrix or raster-graphics that terminfo 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 will vary 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; it 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 strings start and end a dot-matrix image, respectively. The sbim string 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 string and before the rbim string. The number of bytes is a integral multiple of the width of the dot-matrix; the multiple and the form of each byte is determined by the porder string as described below.

The porder string is a comma separated list of pin numbers optionally followed by an numerical offset. The offset, if given, is separated from the list with a semicolon. The position of each pin number in the list corresponds to a bit in an 8-bit data byte. The pins are numbered consecutively from 1 to npins, with 1 being the top pin. Note that the term "pin" is used loosely here; "ink-jet" dot-matrix printers don't have pins, but can be considered to 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. An application produces 8-bit bytes in the order of the groups in porder.

An application computes the "image-data bytes" from the internal image, mapping vertical dot positions in each print-head pass into 8-bit bytes, using a 1 bit where ink should be applied and 0 where no ink should be applied. This can be reversed (0 bit for ink, 1 bit for no ink) by giving a negative pin number. If a position is skipped in porder, a 0 bit is used. If a position has a lower case "x" instead of a pin number, a 1 bit is used in the skipped position. For consistency, a lower case "o" can be used to represent a 0 filled, skipped bit. There must be a multiple of 8 bit positions used or skipped in porder; if not, low-order bits of the last byte are set to 0. The offset, if given, is added to each data byte; the offset can be negative.

Some examples may help clarify the use of the porder string. The AT&T 470, AT&T 475 and C.Itoh 8510 printers provide eight pins for graphics. The pins are identified top to bottom by the 8 bits in a byte, from least significant to most. The porder strings for these printers would be 8,7,6,5,4,3,2,1. The AT&T 478 and AT&T 479 printers also provide eight pins for graphics. However, the pins are identified in the reverse order. The porder strings for these printers would be 1,2,3,4,5,6,7,8. The AT&T 5310, AT&T 5320, Digital LA100, and Digital LN03 printers provide six pins for graphics. The pins are identified top to bottom by the decimal values 1, 2, 4, 8, 16 and 32. These correspond to the low six bits in an 8-bit byte, although the decimal values are further offset by the value 63. The porder string for these printers would be ,,6,5,4,3,2,1;63, equivalent to o,o,6,5,4,3,2,1;63.

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:

Changing the Character/Line Pitches
cpiChange character pitch
cpixIf set, cpi changes spinh
lpiChange line pitch
lpixIf set, lpi changes spinv

Programs that use cpi or lpi should recalculate the dot spacing:

Effects of Changing the Character/Line Pitches
BeforeAfter
Using cpi with cpix clear: 
spinh'spinh
Using cpi with cpix set: 
spinh'spinh = spinh' * orhi / orhi'
Using lpi with lpix clear: 
spinv'spinv
Using lpi with lpix set: 
spinv'spinv = spinv' * orhi / orhi'
Using chr: 
spinh'spinh
Using cvr: 
spinv'spinv

orhi' and orhi 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. It is important to be able to choose one or the other because the rate of printing generally decreases as the quality improves. Three strings describe these capabilities:

Print Quality
snlqSet near-letter quality print
snrmqSet normal quality print
sdrfqSet draft quality print

The capabilities are listed in decreasing levels of quality. If a printer doesn't have all three levels, the respective strings should be left blank.

Printing Rate and Buffer Size

Because there is no standard protocol that can be used to keep a program synchronized with a printer, and because modern printers can buffer data before printing it, a program generally cannot determine at any time what has been printed. Two numeric capabilities can help a program estimate what has been printed.

Print Rate/Buffer Size
cpsNominal print rate in characters per second
bufszBuffer capacity in characters

cps is the nominal or average rate at which the printer prints characters; if this value is not given, the rate should be estimated at one-tenth the prevailing baud rate. bufsz is the maximum number of subsequent characters buffered before the guaranteed printing of an earlier character, assuming proper flow control has been 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.

Note that 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, and 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 will thus err in favor of the user, who wants, above all, to see all the output in its correct place.

Selecting a Terminal

If the environment variable TERMINFO is defined, any program using Curses checks for a local terminal definition before checking in the standard place. For example, if TERM is set to att4424, then the compiled terminal definition is found by default in the path

  • a/att4424

within an implementation-specific directory.

(The "a" is copied from the first letter of att4424 to avoid creation of huge directories.) However, if TERMINFO is set to $HOME/myterms, Curses first checks

  • $HOME/myterms/a/att4424

If that fails, it then checks the default path name.

This is useful for developing experimental definitions or when write permission in the implementation-defined default database is not available.

If the LINES and COLUMNS environment variables are set, or if the program is executing in a window environment, line and column information in the environment will override information read by terminfo.

Application Usage

The most effective way to prepare a terminal description is by imitating the description of a similar terminal in terminfo and to build up a description gradually, using partial descriptions with a screen-oriented editor, to check that they are correct. To easily test a new terminal description, the environment variable TERMINFO can be set to the path name of a directory containing the compiled description, and programs will look there rather than in the terminfo database.

Conventions for Device Aliases

Every device must be assigned a name, such as vt100. Device names (except the long name) should be chosen using the following conventions. The name should not contain hyphens because hyphens are reserved for use when adding suffixes that indicate special modes.

These special modes may be modes that the hardware can be in, or user preferences. To assign a special mode to a particular device, append a suffix consisting of a hyphen and an indicator of the mode to the device name. For example, the -w suffix means wide mode; when specified, it allows for a width of 132 columns instead of the standard 80 columns. Therefore, if you want to use a VT100 device set to wide mode, name the device vt100-w. Use the following suffixes where possible:

SuffixMeaningExample
-wWide mode (more than 80 columns)5410-w
-amWith automatic margins (usually default)vt100-am
-namWithout automatic marginsvt100-nam
-nNumber of lines on the screen2300-40
-naNo arrow keys (leave them in local)c100-na
-npNumber of pages of memoryc100-4p
-rvReverse video4415-rv

Variations of Terminal Definitions

It is implementation-defined how the entries in terminfo may be created.

There is more than one way to write a terminfo entry. A minimal entry may permit applications to use Curses to operate the terminal. If the entry is enhanced to describe more of the terminal's capabilities, applications can use Curses to invoke those features, and can take advantages of optimizations within Curses and thus operate more efficiently. For most terminals, an optimal terminfo entry has already been written.

EXTERNAL INFLUENCES

Environment Variables

CC

Specifies a substitute character for a prototype command character. See cmdch in the Miscellaneous subsection of the Insert/Delete Line section.

COLUMNS

Specifies column information that can override the column information in terminfo. See the Selecting a Terminal section.

LINES

Specifies lines information that can override the lines information in terminfo. See the Selecting a Terminal section.

TERM

Specifies the name of the current terminal. See the Selecting a Terminal section.

TERMINFO

Specifies an alternate location for a local terminal definition. If the value in TERM is not found in $TERMINFO/?/* or if TERMINFO is not set, the value is sought in the default location, /usr/lib/terminfo/?/*. See the Selecting a Terminal section.

SEE ALSO

tic(1), untic(1), tgetent(3X), tigetflag(3X), term(4), term(5).

ANSI Standard X3.64-1979.

X/Open System Interface Definitions, Issue 4, Version 2.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.