TERMINFO(5)

NAME
terminfo - terminal capability definition

DESCRIPTION
terminfo describes the capabilities of terminals, used by programs such as vi(1), rogue(6) and libraries such as curses(3). The terminfo source described here needs to be compiled with tic(1) to be of any use.

Entries in terminfo consist of a number of comma separated fields. White space after each comma is ignored. Embedded commas must be escaped by using a backslash. Lines beginning with ‘#’ in the first column are treated as comments. Blank lines are ignored.

The header line must begin in column one and end with a comma. Inside the header line are terminal name and aliases, separated by vertical bars, the last one being the long description of the terminal.

Capability lines then follow, starting on column two and ending with a comma. Each capability is listed by its name, followed by its value if applicable. Booleans have no values, numeric values are prefixed by ‘#’ and strings are prefixed by ‘=’. Numbers can range from 0 to 32767 and string values can be up to 1000 characters long. This implementation supports strings upto 32767 characters long, including the NUL terminator.

Some escapes are available for strings - both \E and \e map to the ESC character, ^X maps to a control-X for any appropriate X, and the sequences \n, \r, \t, \b and \f map to linefeed, return, tab, backspace, and formfeed respectively. Any character can be escaped in octal, such as \072. If you need to encode a NUL character, it should be escaped as \200.

A delay in milliseconds may appear anywhere in a string capability, prefixed with a dollar sign and enclosed by angled brackets, such as $5.

  String Parameters
String capabilities sometimes require parameters. Normally this just involves replacing the parameter with a supplied variable; however, there are cases where the variable needs to be manipulated or used in conditional expressions. A stack is also provided for simple pop and push operations.

The below % encodings have the following meanings:

%%  outputs %

%[[:]flags][width[.precision]][doxXs]
    flags are “[-+#]”. Prefix with ‘’: to avoid interpreting “%-” as an operator.

%c  pop a parameter and print the character representation of it.

%s  pop a parameter and print the string representation of it.

%p[1-9]
    push the parameter [1-9].

%P[a-z]
    pop a parameter and push it to dynamic variable [a-z].

%g[a-z]
    push the dynamic variable [a-z].

%P[A-Z]
    pop a parameter and push it to static variable [a-z].

%g[A-Z]
    push the dynamic variable [A-Z].

    Static variables persist over tparm() whereas dynamic variables do not.

%'c'
    char constant c.

%{nn}
    integer constant nn.

%l  push the string length of the previously popped parameter.

%+ %- %* %/ %m
    arithmetic: pop two parameters and push the result.

%& %| %^
    bit operations: pop two parameters and push the result.

%! %~
    unary operations: pop two parameters and push the result.

%i  add 1 to parameters 1 and 2.

%? expr %t then %e else %;
    If expr equates to zero then control passes to the optional else part.

  Boolean Capabilities
Long name | Code | TC
@BOOLCAPS@

  Numeric Capabilities
Long name | Code | TC
@NUMCAPS@

  String Capabilities
Long name | Code | TC
@STRCAPS@

  A Sample Entry

    vt100|dec vt100 (w/advanced video),
    am, xenl, msgr, mc5i, xon,
    cols#80, it#8, lines#24, vt#3,
    acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G,
    cr=^M, csr=\E[%i%p1%d;%p2%dr, tbc=\E[3g, clear=\E[H\E[J$50,
    el1=\E[1K$3, el=\E[K$3, ed=\E[J$50,
    cup=\E[%i%p1%d;%p2%dH$5, cud1=^J, home=\E[H, cub1=^H,
    cuf1=\E[C$2, cuu1=\E[A$2, enacs=\E(B\E)0, smacs=^N,
    smam=\E[?7h, blink=\E[5m$2, bold=\E[1m$2, rev=\E[7m$2,
    smso=\E[7m$2, smul=\E[4m$2, rmacs=^O, rmam=\E[?7l,
    sgr0=\E[m017$2, rmso=\E[m$2, rmul=\E[m$2, ka1=\EOq,
    ka3=\EOs, kb2=\EOr, kbs=^H, kc1=\EOp, kc3=\EOn, kcud1=\EOB,
    kent=\EOM, kf0=\EOy, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
    kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, kf10=\EOx,
    kcub1=\EOD, kcuf1=\EOC, kcuu1=\EOA, rmkx=\E[?1l\E,
    smkx=\E[?1h\E=, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4,
    cud=\E[%p1%dB, cub=\E[%p1%dD, cuf=\E[%p1%dC, cuu=\E[%p1%dA,
    mc0=\E[0i, mc4=\E[4i, mc5=\E[5i,
    rs2=\E\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, rc=\E8, sc=\E7,
    ind=^J, ri=\EM$5,
    sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t016%e017%;$2,
    hts=\EH, ht=^I,

  Fetching Compiled Descriptions
This implementation uses hashed databases managed by ndbm(3) instead of directories. To maintain compatability with other implementations, .db is appended to each file checked.

If the environment variable TERMINFO is available, does not begin with (‘/’), can be compiled with the above rules and whose name matches TERM then it is used.

If the environment variable TERMCAP is available and does not begin with a slash (‘/’) then it will be translated into terminfo and compiled as above. If its name matches TERM then it is used.

If the environment variable TERMINFO is available and begins with a slash (‘/’) then only this file is searched. Otherwise terminfo will first look for $HOME/.terminfo, followed by /usr/share/misc/terminfo unless TERMINFO_DIRS is available. If a matching description is not found then a small embedded database is searched, which currently holds descriptions for ansi, dumb, vt100, vt220, wsvt25, and xterm.

FILES
$HOME/.terminfo.db
    Database of terminal descriptions for personal use.
/usr/share/misc/terminfo
    File containing terminal descriptions.
/usr/share/misc/terminfo.db
    Database of terminal descriptions.

SEE ALSO
infocmp(1), tic(1), tput(1), curses(3), ndbm(3)

STANDARDS
terminfo complies with the xcurses4.2 standard.

Extensions to the standard are noted in tic(1).

AUTHORS
Roy Marples <roy@NetBSD.org>

BUGS
The TERMCAP capabilities %, %B and %D are not converted into terminfo capabilities.