terminfo
NAME
SYNOPSIS
DESCRIPTION
EXTENSIONS
FILES
SEE ALSO
AUTHORS
NAME
terminfo − terminal capability data base
SYNOPSIS
/usr/share/terminfo/*/*
DESCRIPTION
Terminfo is a data base describing terminals, used by screen-oriented programs such as nvi(1), lynx(1), mutt(1), and other curses applications, using high-level calls to libraries such as curses(3X). It is also used via low-level calls by non-curses applications which may be screen-oriented (such as clear(1)) or non-screen (such as tabs(1)).
Terminfo describes terminals by giving a set of capabilities which they have, by specifying how to perform screen operations, and by specifying padding requirements and initialization sequences.
This manual describes ncurses version 6.2 (patch 20201205).
Terminfo Entry Syntax
Entries in terminfo consist of a sequence of fields:
• |
Each field ends with a comma “,” (embedded commas may be escaped with a backslash or written as “ 54”). |
||
• |
White space between fields is ignored. |
||
• |
The first field in a terminfo entry begins in the first column. |
||
• |
Newlines and leading whitespace (spaces or tabs) may be used for formatting entries for readability. These are removed from parsed entries. |
The infocmp −f and −W options rely on this to format if-then-else expressions, or to enforce maximum line-width. The resulting formatted terminal description can be read by tic.
• |
The first field for each terminal gives the names which are known for the terminal, separated by “|” characters. |
The first name given is the most common abbreviation for the terminal (its primary name), the last name given should be a long name fully identifying the terminal (see longname(3X)), and all others are treated as synonyms (aliases) for the primary terminal name.
X/Open Curses advises that all names but the last should be in lower case and contain no blanks; the last name may well contain upper case and blanks for readability.
This implementation is not so strict; it allows mixed case in the primary name and aliases. If the last name has no embedded blanks, it allows that to be both an alias and a verbose name (but will warn about this ambiguity).
• |
Lines beginning with a “#” in the first column are treated as comments. |
While comment lines are legal at any point, the output of captoinfo and infotocap (aliases for tic) will move comments so they occur only between entries.
Terminal names (except for the last, verbose entry) should be chosen using the following conventions. The particular piece of hardware making up the terminal should have a root name, thus “hp2621”. This name should not contain hyphens. Modes that the hardware can be in, or user preferences, should be indicated by appending a hyphen and a mode suffix. Thus, a vt100 in 132-column mode would be vt100−w. The following suffixes should be used where possible:
For more on terminal naming conventions, see the term(7) manual page.
Terminfo Capabilities Syntax
The terminfo entry consists of several capabilities, i.e., features that the terminal has, or methods for exercising the terminal’s features.
After the first field (giving the name(s) of the terminal entry), there should be one or more capability fields. These are boolean, numeric or string names with corresponding values:
• |
Boolean capabilities are true when present, false when absent. There is no explicit value for boolean capabilities. |
||
• |
Numeric capabilities have a “#” following the name, then an unsigned decimal integer value. |
||
• |
String capabilities have a “=” following the name, then an string of characters making up the capability value. |
String capabilities can be split into multiple lines, just as the fields comprising a terminal entry can be split into multiple lines. While blanks between fields are ignored, blanks embedded within a string value are retained, except for leading blanks on a line.
Any capability can be canceled, i.e., suppressed from the terminal entry, by following its name with “@” rather than a capability value.
Similar Terminals
If there are two very similar terminals, one (the variant) can be defined as being just like the other (the base) with certain exceptions. In the definition of the variant, the string capability use can be given with the name of the base terminal:
• |
The capabilities given before use override those in the base type named by use. |
||
• |
If there are multiple use capabilities, they are merged in reverse order. That is, the rightmost use reference is processed first, then the one to its left, and so forth. |
||
• |
Capabilities given explicitly in the entry override those brought in by use references. |
A capability can be canceled by placing xx@ to the left of the use reference that imports it, where xx is the capability. For example, the entry
2621−nl, smkx@, rmkx@, use=2621,
defines a 2621−nl that does not have the smkx or rmkx capabilities, and hence does not turn on the function key labels when in visual mode. This is useful for different modes for a terminal, or for different user preferences.
An entry included via use can contain canceled capabilities, which have the same effect as if those cancels were inline in the using terminal entry.
Predefined Capabilities
The following is a complete table of the capabilities included in a terminfo description block and available to terminfo-using code. In each line of the table,
The variable is the name by which the programmer (at the terminfo level) accesses the capability.
The capname is the short name used in the text of the database, and is used by a person updating the database. Whenever possible, capnames are chosen to be the same as or similar to the ANSI X3.64-1979 standard (now superseded by ECMA-48, which uses identical or very similar names). Semantics are also intended to match those of the specification.
The termcap code is the old termcap capability name (some capabilities are new, and have names which termcap did not originate).
Capability names have no hard length limit, but an informal limit of 5 characters has been adopted to keep them short and to allow the tabs in the source file Caps to line up nicely.
Finally, the description field attempts to convey the semantics of the capability. You may find some codes in the description field:
(P) |
indicates that padding may be specified |
||
#[1-9] |
in the description field indicates that the string is passed through tparm(3X) with parameters as given (#i). |
If no parameters are listed in the description, passing the string through tparm(3X) may give unexpected results, e.g., if it contains percent (%%) signs.
(P*) |
indicates that padding may vary in proportion to the number of lines affected |
||
(#i) |
indicates the ith parameter. |
These are the boolean capabilities:
These are the numeric capabilities:
The following numeric capabilities are present in the SVr4.0 term structure, but are not yet documented in the man page. They came in with SVr4’s printer support.
These are the string capabilities:
The following string capabilities are present in the SVr4.0 term structure, but were originally not documented in the man page.
The XSI Curses standard added these hardcopy capabilities. They were used in some post-4.1 versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x. Except for YI, the ncurses termcap names for them are invented. According to the XSI Curses standard, they have no termcap names. If your compiled terminfo entries use these, they may not be binary-compatible with System V terminfo entries after SVr4.1; beware!
User-Defined Capabilities
The preceding section listed the predefined capabilities. They deal with some special features for terminals no longer (or possibly never) produced. Occasionally there are special features of newer terminals which are awkward or impossible to represent by reusing the predefined capabilities.
ncurses addresses this limitation by allowing user-defined capabilities. The tic and infocmp programs provide the −x option for this purpose. When −x is set, tic treats unknown capabilities as user-defined. That is, if tic encounters a capability name which it does not recognize, it infers its type (boolean, number or string) from the syntax and makes an extended table entry for that capability. The use_extended_names(3X) function makes this information conditionally available to applications. The ncurses library provides the data leaving most of the behavior to applications:
• |
User-defined capability strings whose name begins with “k” are treated as function keys. |
||
• |
The types (boolean, number, string) determined by tic can be inferred by successful calls on tigetflag, etc. |
||
• |
If the capability name happens to be two characters, the capability is also available through the termcap interface. |
While termcap is said to be extensible because it does not use a predefined set of capabilities, in practice it has been limited to the capabilities defined by terminfo implementations. As a rule, user-defined capabilities intended for use by termcap applications should be limited to booleans and numbers to avoid running past the 1023 byte limit assumed by termcap implementations and their applications. In particular, providing extended sets of function keys (past the 60 numbered keys and the handful of special named keys) is best done using the longer names available using terminfo.
A Sample Entry
The following entry, describing an ANSI-standard terminal, is representative of what a terminfo entry for a modern terminal typically looks like.
ansi|ansi/pc-term compatible with color,
am, mc5i, mir, msgr,
colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,
acsc=+ 20, 21- 30.^Y0333‘ 04a261f370g361h260
j331k277l332m300n305o~p304q304r304s_t303
u264v301w302x263y363z362{343|330}234~376,
bel=^G, blink=E[5m, bold=E[1m, cbt=E[Z, clear=E[HE[J,
cr=^M, cub=E[%p1%dD, cub1=E[D, 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, dch=E[%p1%dP, dch1=E[P,
dl=E[%p1%dM, dl1=E[M, ech=E[%p1%dX, ed=E[J, el=E[K,
el1=E[1K, home=E[H, hpa=E[%i%p1%dG, ht=E[I, hts=EH,
ich=E[%p1%d@, il=E[%p1%dL, il1=E[L, ind=^J,
indn=E[%p1%dS, invis=E[8m, kbs=^H, kcbt=E[Z, kcub1=E[D,
kcud1=E[B, kcuf1=E[C, kcuu1=E[A, khome=E[H, kich1=E[L,
mc4=E[4i, mc5=E[5i, nel=rE[S, op=E[39;49m,
rep=%p1%cE[%p2%{1}%-%db, rev=E[7m, rin=E[%p1%dT,
rmacs=E[10m, rmpch=E[10m, rmso=E[m, rmul=E[m,
s0ds=E(B, s1ds=E)B, s2ds=E*B, s3ds=E+B,
setab=E[4%p1%dm, setaf=E[3%p1%dm,
sgr=E[0;10%?%p1%t;7%;
%?%p2%t;4%;
%?%p3%t;7%;
%?%p4%t;5%;
%?%p6%t;1%;
%?%p7%t;8%;
%?%p9%t;11%;m,
sgr0=E[0;10m, smacs=E[11m, smpch=E[11m, smso=E[7m,
smul=E[4m, tbc=E[3g, u6=E[%i%d;%dR, u7=E[6n,
u8=E[?%[;0123456789]c, u9=E[c, vpa=E[%i%p1%dd,
Entries may continue onto multiple lines by placing white space at the beginning of each line except the first. Comments may be included on lines beginning with “#”. Capabilities in terminfo are of three types:
• |
Boolean capabilities which indicate that the terminal has some particular feature, |
||
• |
numeric capabilities giving the size of the terminal or the size of particular delays, and |
||
• |
string capabilities, which give a sequence which can be used to perform particular terminal operations. |
Types of Capabilities
All capabilities have names. For instance, the fact that ANSI-standard terminals have automatic margins (i.e., an automatic return and line-feed when the end of a line is reached) is indicated by the capability am. Hence the description of ansi includes am. Numeric capabilities are followed by the character “#” and then a positive value. Thus cols, which indicates the number of columns the terminal has, gives the value “80” for ansi. Values for numeric capabilities may be specified in decimal, octal or hexadecimal, using the C programming language conventions (e.g., 255, 0377 and 0xff or 0xFF).
Finally, string valued capabilities, such as el (clear to end of line sequence) are given by the two-character code, an “=”, and then a string ending at the next following “,”.
A number of escape sequences are provided in the string valued capabilities for easy encoding of characters there:
• |
Both E and e map to an ESCAPE character, |
|||
• |
^x maps to a control-x for any appropriate x, and |
|||
• |
the sequences |
n, l, r, t, b, f, and s
produce
newline, line-feed, return, tab, backspace, form-feed, and space,
respectively.
X/Open Curses does not say what “appropriate x” might be. In practice, that is a printable ASCII graphic character. The special case “^?” is interpreted as DEL (127). In all other cases, the character value is AND’d with 0x1f, mapping to ASCII control codes in the range 0 through 31.
Other escapes include
• |
^ for ^, |
|||
• |
\ for , |
|||
• |
, for comma, |
|||
• |
: for :, |
|||
• |
and |