infocmp Command

Purpose

Manages terminfo descriptions.

Syntax

infocmp [ -d] [ -c] [ -n] [ -I] [ -L] [ -C] [ -r] [ -u] [ -s { d| i| l| c}] [ -v] [ -V] [ -1] [ -w Width] [ -A Directory] [ -B Directory] [TermName...]

Description

The infocmp command manages terminfo descriptions. You can use this command to:

The infocmp command prints the Boolean attributes first, the numeric attributes second, and the string attributes last.

Comparing Entries

Use the -d, -c, and -n flags to compare entries. The -d flag returns the differences between entries. The -c flag produces a list of the capabilities that are set and in common between two entries. The -n flag returns a list of the capabilities that neither entry has.

To compare terminfo entries, you specify two or more TermName parameters. The infocmp command compares the terminfo description of the first TermName parameter with each of the descriptions for the subsequent TermNames specified. If a capability is defined for only one of the terminal descriptions, the value returned will depend on the type of capability. For Boolean capabilities the infocmp command returns an F, the command returns a -1 for integer capabilities, and null for string capabilities.

Producing a Source Listing

Use the -l (uppercase i), -L, -C, and -r flags to produce a source listing for one or more terminals. If you do not specify a TermName parameter, the system uses the TERM environment variable. You can use these source options to produce a source file for a terminfo binary when one is not available.

The I (uppercase i) flag produces a listing with the terminfo names. The -L flag produces a listing using the long C variable names listed in /usr/include/term.h.

The -C flag uses termcap names instead of terminfo capability names when producing the source listing. The infocmp commands translates and outputs only those terminfo capabilities that have a corresponding termcap code name. To remove this restriction, specifying the -r flag. This flag causes the command to output terminfo capabilities that cannot be translated into termcap format.

When using the -C and -r flags, the infocmp command notes any string parameters it was unable to convert to the termcap format. You must edit these parameters manually. The command collects all padding information for strings together and places it at the beginning of the string where termcap expects it. Mandatory padding is optional after translation. Mandatory padding is padding information with a trailing / (slash).

Note: The -C and -r flags cannot always convert a terminfo string into its equivalent termcap form. Similarly, a conversion from the termcap file format back into the terminfo file format does not necessarily reproduce the original source.

Definitions with the use Attribute

Given a list of terminal menus and the -u flag, the infocmp command compares the first terminal's description against the other terminal descriptions. The infocmp command then creates a new description for the first terminal using as much of the subsequent terminal descriptions as possible.

When you specify the -u flag and a list of terminal names, the infocmp command does the following:

The new description for the first terminal will have the following:

You can change a description and specify a capability after the use attribute. If this capability is also found in the terminal referenced by the use attribute, the second capability takes precedence over the one referenced by the use attribute.

Changing Databases

By default, terminal descriptions appear in the system terminfo database directory, /usr/share/lib/terminfo. You can specify a different database location with the TERMINFO environment variable. The infocmp command first checks to see if this variable exists. If the variable does not exist, the command uses the system terminfo database.

You can use the -A and -B flag with the infocmp command to override the system database. The -A flag identifies the terminfo database for the first TermName parameter. The -B flag identifies the database to use for any subsequent terminals you name. Together, these flags make it possible to compare descriptions for two terminals with the same name located in two different databases.

Flags

Item Description
-A Directory Identifies the terminfo database for the first TermName parameter.
-B Directory Identifies the terminfo database for every TermName parameter except the first.
-C Uses the termcap code names to produce the source listing. Will not list terminfo capabilities that cannot be translated to termcap format.
-c Lists the capabilities that are common between the two entries. Capabilities that are not set are ignored. This flag can be used as a quick check to see if it is desirable to use the -u flag.
-d Lists the capabilities that are different between terminals. You can use this flag to pinpoint the differences between similar terminal entries.
-I (uppercase i) Uses the terminfo capability names when producing the source listing.
-1 (numeral) Prints the capabilities one to a line. by default, the fields are printed several to a line to a maximum width of 60 characters.
-L Uses the long C variable name listed in /usr/include/term.h file to produce the source listing.
-n Compares two entries and lists the capabilities that do not exist in either. If you do not specify a TermName parameter, the system uses the TERM environment variable for both TermName parameters. You can use this as a quick check to see if anything was left out of the description.
-r Instructs the infocmp command to output terminfo capabilities that cannot be translated to termcap format. This flag is valid only with the -C flag.
-s Sorts the output from the infocmp command within each capability type (Boolean, numeric, and string) and according to the argument below:
d
Sort in the order specified in the terminfo database.
i
Sort by terminfo name.
l
Sort by the long C variable name.
c
Sort by the termcap name.

If you do not specify an option with the -s flag, the command sorts each capability alphabetically by the terminfo name within each type. If you specify the -C or the -L flags with the -s flag, the capabilities are sorted by the termcap name or the long C variable name, respectively.

-u Compares two or more terminal descriptions and produces new descriptions using the use attribute.
-v Prints out tracing information on standard error.
-V Prints out the version of the program in use on standard error and exits.
-w Width Changes the output to the specified number of characters per line. The output includes as many fields as possible that can fit within the specified number of characters.
Note: Fields are not truncated.

Examples

  1. To list the common capabilities between the aixterm and lft terminals, enter:
    infocmp -c aixterm lft
  2. To list all of the capabilities that are possible but do not currently exist for the current terminal, enter:
    infocmp -n
  3. To produce a source listing for the lft terminal in terminfo format, enter:
    infocmp -I lft
  4. To produce a source listing for the terminal description my_term that is located in /tmp using as much of the lft description as possible, enter:
    infocmp -A /tmp -u my_term lft

File

Item Description
/usr/share/lib/terminfo Contains the compiled terminal description database.