Terminfo
   HOME

TheInfoList



OR:

Terminfo is a
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vi ...
and
database In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases ...
that enables programs to use display terminals in a device-independent manner.
Mary Ann Horton Mary Ann Horton (born Mark R. Horton, on November 21, 1955), is a Usenet and Internet pioneer. Horton contributed to Berkeley UNIX (BSD), including the vi editor and terminfo database, (see Acknowlegments section at end of file) created the firs ...
implemented the first terminfo library in 1981–1982 as an improvement over
termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
. The improvements include * faster access to stored terminal descriptions, * longer, more understandable names for terminal capabilities and * general expression evaluation for strings sent to the terminal. Terminfo was included with
UNIX System V Unix System V (pronounced: "System Five") is one of the first commercial versions of the Unix operating system. It was originally developed by AT&T and first released in 1983. Four major versions of System V were released, numbered 1, 2, 3, an ...
Release 2 and soon became the preferred form of terminal descriptions in System V, rather than
termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
(which BSD continued to use). This was imitated in pcurses in 1982–1984 by Pavel Curtis, and was available on other
UNIX Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, ...
implementations, adapting or incorporating fixes from Mary Horton. For more information, refer to the posting on the comp.sources.unix newsgroup from December 1986. A terminfo database can describe the capabilities of hundreds of different display terminals. This allows external programs to be able to have character-based display output, independent of the type of terminal. Some configurations are: *Number of lines on the screen *Mono mode; suppress color *Use visible bell instead of beep


Data model

Terminfo databases consist of one or more descriptions of terminals.


Indices

Each description must contain the
canonical The adjective canonical is applied in many contexts to mean "according to the canon" the standard, rule or primary source that is accepted as authoritative for the body of knowledge or literature in that context. In mathematics, "canonical examp ...
name of the terminal. It may also contain one or more aliases for the name of the terminal. The canonical name or aliases are the keys by which the library searches the terminfo database.


Data values

The description contains one or more capabilities, which have conventional names. The capabilities are typed: ''boolean'', ''numeric'' and ''string''. The terminfo library has predetermined types for each capability name. It checks the types of each capability by the syntax: * ''string'' capabilities have an "=" between the capability name and its value, * ''numeric'' capabilities have a "#" between the capability name and its value, and * ''boolean'' capabilities have no associated value (they are always ''true'' if specified). Applications which use terminfo know the types for the respective capabilities, and obtain the values of capabilities from the terminfo database using library calls that return successfully only when the capability name corresponds to one of the predefined typed capabilities. Like
termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
, some of the ''string'' capabilities represent
escape sequence In computer science, an escape sequence is a combination of characters that has a meaning other than the literal characters contained therein; it is marked by one or more preceding (and possibly terminating) characters. Examples * In C and ma ...
s which may be sent to the host by pressing special keys on the keyboard. Other capabilities represent strings that may be sent by an application to the terminal. In the latter case, the terminfo library functions (as does a termcap library) for substituting application
parameters A parameter (), generally, is any characteristic that can help in defining or classifying a particular system (meaning an event, project, object, situation, etc.). That is, a parameter is an element of a system that is useful, or critical, when ...
into the string which is sent. These functions provide a
stack-based Stack-oriented programming, is a programming paradigm which relies on a stack machine model for passing parameters. Stack-oriented languages operate on one or more stacks, each of which may serve a different purpose. Programming constructs i ...
expression parser, which is primarily used to help minimize the number of characters sent for control sequences which have optional parameters such as SGR (Select Graphic Rendition). In contrast, termcap libraries provide a limited set of operations which are useful for most terminals.


Hierarchy

Terminfo descriptions can be constructed by including the contents of one description in another, suppressing capabilities from the included description or overriding or adding capabilities. No matter what storage model is used, the terminfo library returns the terminal description from the requested description, using data which is compiled using a standalone tool (e.g., tic).


Storage model

Terminfo data is stored as a
binary file A binary file is a computer file that is not a text file. The term "binary file" is often used as a term meaning "non-text file". Many binary file formats contain parts that can be interpreted as text; for example, some computer document fil ...
, making it less simple to modify than
termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
. The data can be retrieved by the terminfo library from the files where it is stored. The data itself is organized as tables for the boolean, numeric and string capabilities, respectively. This is the scheme devised by Mary Horton, and except for some differences regarding the available names is used in most terminfo implementations.
X/Open X/Open group (also known as the Open Group for Unix Systems and incorporated in 1987 as X/Open Company, Ltd.) was a consortium founded by several European UNIX systems manufacturers in 1984 to identify and promote open standards in the field of info ...
does not specify the format of the compiled terminal description. In fact, it does not even mention the common tic or infocmp utilities. Because the compiled terminfo entries do not contain
metadata Metadata is "data that provides information about other data", but not the content of the data, such as the text of a message or the image itself. There are many distinct types of metadata, including: * Descriptive metadata – the descriptive ...
identifying the indices within the tables to which each capability is assigned, they are not necessarily compatible between implementations. However, since most implementations use the same overall table structure (including sizes of header and data items), it is possible to automatically construct customized terminfo libraries which can read data for a given implementation. For example,
ncurses ncurses (new curses) is a programming library providing an application programming interface (API) that allows the programmer to write text-based user interfaces (TUI) in a terminal-independent manner. It is a toolkit for developing "GUI-like" ...
can be built to match the terminfo data for several other implementations.


Directory tree

The original (and most common) implementation of the terminfo library retrieves data from a
directory Directory may refer to: * Directory (computing), or folder, a file system structure in which to store computer files * Directory (OpenVMS command) * Directory service, a software application for organizing information about a computer network' ...
hierarchy A hierarchy (from Greek: , from , 'president of sacred rites') is an arrangement of items (objects, names, values, categories, etc.) that are represented as being "above", "below", or "at the same level as" one another. Hierarchy is an important ...
. By using the first character of the name of the terminal description as one component of the pathname, and the name of the terminal description as the name of the file to retrieve, the terminfo library usually outperforms searching a large termcap file.


Hashed database

Some implementations of terminfo store the terminal description in a hashed database (e.g., something like
Berkeley DB Berkeley DB (BDB) is an unmaintained embedded database software library for key/value data, historically significant in open source software. Berkeley DB is written in C with API bindings for many other programming languages. BDB stores arbitr ...
version 1.85). These store two types of records: aliases which point to the canonical entry, and the canonical entry itself, which contains the data for the terminal capabilities.


Limitations and extensions

The Open Group The Open Group is a global consortium that seeks to "enable the achievement of business objectives" by developing "open, vendor-neutral technology standards and certifications." It has over 840 member organizations and provides a number of servi ...
documents the limits for terminfo (minimum guaranteed values), which apply only to the source file. Two of these are of special interest: * 14 character maximum for terminal aliases * 32,767 maximum for numeric quantities The 14-character limit addresses very old filesystems which could represent filenames no longer than that. While those filesystems are generally obsolete, these limits were as documented from the late 1980s, and unreviewed since then. The 32,767 limit is for positive values in a signed
two's complement Two's complement is a mathematical operation to reversibly convert a positive binary number into a negative binary number with equivalent (but negative) value, using the binary digit with the greatest place value (the leftmost bit in big- endian ...
16-bit value. A terminfo entry may use negative numbers to represent cancelled or absent values. Unlike
termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
, terminfo has both a source and compiled representation. The limits for the compiled representation are unspecified. However, most implementations note in their documentation for tic (terminal information compiler) that compiled entries cannot exceed 4,096 bytes in size.


See also

*
Computer terminals A computer terminal is an electronic or electromechanical hardware device that can be used for entering data into, and transcribing data from, a computer or a computing system. The teletype was an example of an early-day hard-copy terminal a ...
*
Curses (programming library) curses is a terminal control library for Unix-like systems, enabling the construction of text user interface (TUI) applications. The name is a pun on the term " cursor optimization". It is a library of functions that manage an application's di ...
*
Termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
*
tput In computing, tput is a standard Unix operating system command which makes use of terminal capabilities. Depending on the system, ''tput'' uses the terminfo or termcap database, as well as looking into the environment for the terminal type. ...


References

{{reflist


External links


Current terminfo dataTermcap/Terminfo Resources Page
at
Eric S. Raymond Eric Steven Raymond (born December 4, 1957), often referred to as ESR, is an American software developer, open-source software advocate, and author of the 1997 essay and 1999 book ''The Cathedral and the Bazaar''. He wrote a guidebook for the ...
's website
man terminfo(5)
Database management systems Unix software Text mode 1980s software