DESCRIPTION
The termcap database is an obsolete facility for
describing the capabilities of character-cell terminals and
printers. It is retained only for capability with old
programs; new ones should use the terminfo(5) database and
associated libraries.
/etc/termcap is an ASCII
file (the database master) that lists the capabilities of
many different types of terminals. Programs can read termcap
to find the particular escape codes needed to control the
visual attributes of the terminal actually in use. (Other
aspects of the terminal are handled by stty(1).) The termcap
database is indexed on the TERM environment variable.
Termcap entries must be defined on a single logical line,
with `\' used to suppress the newline. Fields are separated
by `:'. The first field of each entry starts at the left-hand
margin, and contains a list of names for the terminal,
separated by '|'.
The first subfield may (in BSD termcap entries from
versions 4.3 and prior) contain a short name consisting of
two characters. This short name may consist of capital or
small letters. In 4.4BSD termcap entries this field is
omitted.
The second subfield (first, in the newer 4.4BSD format)
contains the name used by the environment variable TERM. It
should be spelled in lowercase letters. Selectable hardware
capabilities should be marked by appending a hyphen and a
suffix to this name. See below for an example. Usual suffixes
are w (more than 80 characters wide), am (automatic margins),
nam (no automatic margins), and rv (reverse video display).
The third subfield contains a long and descriptive name for
this termcap entry.
Subsequent fields contain the terminal capabilities; any
continued capability lines must be indented one tab from the
left margin.
Although there is no defined order, it is suggested to
write first boolean, then numeric, and then string
capabilities, each sorted alphabetically without looking at
lower or upper spelling. Capabilities of similar functions
can be written in one line.
String Capabilities
There are several ways of defining the control codes for
string capabilities:
Every normal character represents itself, except '^','\'
and '%'.
A '^x' means Control-x. Control-A equals 1 decimal.
\x means a special code. x can be one of the following
characters:
E Escape (27)
n Linefeed (10)
r Carriage return (13)
t Tabulation (9)
b Backspace (8)
f Form feed (12)
0 Null character. A \xxx specifies the octal
character xxx.
i
-
Increments parameters by one.
r
-
Single parameter capability
+
-
Add value of next character to this parameter and
do binary output
2
-
Do ASCII output of this parameter with a field
with of 2
d
-
Do ASCII output of this parameter with a field
with of 3
%
-
Print a '%'
If you use binary output, then you should avoid the null
character because it terminates the string. You should
reset tabulator expansion if a tabulator can be the binary
output of a parameter.
![[Warning]](../stylesheet/warning.png) |
Warning |
|
The above metacharacters for parameters may be
wrong, they document Minix termcap which may not be
compatible with Linux termcap.
|
The block graphic characters can be specified by three
string capabilities:
as
-
start the alternative charset
ae
-
end it
ac
-
pairs of characters. The first character is the
name of the block graphic symbol and the second
characters is its definition.
The following names are available:
The values in parentheses are suggested defaults which
are used by curses, if the capabilities are missing.