CAPFILE(5) | File Formats Manual | CAPFILE(5)

# NAME

`capfile` —
capability database files

# DESCRIPTION

`capfile` describes the format of capability database files, made popular by `termcap`. `termcap` itself has been superseded by terminfo(5), which contains equivalent `termcap` capabilities, and this page exists solely to document the `termcap` format as it is still used by other programs such as rtadvd.conf(5).

Entries in `capfile` consist of a number of `:'-separated fields. The first entry for each record gives the names that are known for the record, separated by `|' characters. By convention, the last name is usually a comment and is not intended as a lookup tag. The entry must be terminated by the `:' character.

## A Sample Entry

The following entry describes the Teletype model 33.

    T3|tty33|33|tty|Teletype model 33:\
    	:bl=^G:co#72:.cr=9^M:cr=^M:do=^J:hc:os:am@:

Entries may continue onto multiple lines by giving a \ as the last character of a line, and empty fields may be included for readability (here between the last field on a line and the first field on the next). Comments may be included on lines beginning with “#”.

## Types of Capabilities

Capabilities in `capfile` are of three types: Boolean capabilities, numeric capabilities, and string capabilities.

Boolean capabilities are just the name, to indicate the ability is present.

Numeric capabilities are followed by the character `#' then the value. In the example above co gives the value `72'.

String capabilities are followed by the character `=' and then the string. In the example above bl gives the value `^G'.

Sometimes individual capabilities must be commented out. To do this, put a period (`.') before the capability name. For example, see the first cr in the example above.

Sometimes individual capabilities must be marked as absent. To do this, put a @ after the capability name. For example, see the last am in the example above. This is only useful when merging entries. See the tc=name discussion below for more details.

## Encoding

Numeric capability values may be given in one of three numeric bases. If the number starts with either ‘`0x`’ or ‘`0X`’ it is interpreted as a hexadecimal number (both upper and lower case a-f may be used to denote the extended hexadecimal digits). Otherwise, if the number starts with a ‘`0`’ it is interpreted as an octal number. Otherwise the number is interpreted as a decimal number.

String capability values may contain any character. Non-printable `ASCII` codes, new lines, and colons may be conveniently represented by the use of escape sequences:

^X | ('X' & 037) | control-X
\b, \B | (ASCII 010) | backspace
\t, \T | (ASCII 011) | tab
\n, \N | (ASCII 012) | line feed (newline)
\f, \F | (ASCII 014) | form feed
\r, \R | (ASCII 015) | carriage return
\e, \E | (ASCII 027) | escape
\c, \C | (:) | colon
\\ | (\) | back slash
\^ | (^) | caret
\nnn | (ASCII octal nnn)

A ‘\’ followed by up to three octal digits directly specifies the numeric code for a character. The use of ASCII `NUL`s, while easily encoded, causes all sorts of problems and must be used with care since `NUL`s are typically used to denote the end of strings; many applications use ‘\200’ to represent a `NUL`.

A special capability, “tc=name”, is used to indicate that the record specified by name should be substituted for the “tc” capability. “tc” capabilities may interpolate records which also contain “tc” capabilities and more than one “tc” capability may be used in a record. A “tc” expansion scope (i.e. where the argument is searched for) contains the file in which the “tc” is declared and all subsequent files in the file array.

# SEE ALSO

cgetcap(3), termcap(3), terminfo(5)

# HISTORY

`termcap` described the capabilities of terminals, used by programs such as vi(1) and hack(6). These programs still use `termcap` today, but their capability requests are mapped onto terminfo(5) ones instead. As such, the termcap database file is no longer shipped with NetBSD.

# AUTHORS

Roy Marples <roy@NetBSD.org>

March 27, 2012 | NetBSD 10.1