Specifying Terminal Characteristics
Unix programs are generally written to beterminal-independent: they don’t know about or rely on the
specific characteristics of any particular kind ofterminal, but rather, they call a standard screen
manipulation library that is responsible for interfacing to actual
terminals. Such libraries serve to map general terminal characteristics
and functions (e.g., clearing the screen) to the specific character
sequences required to perform them on any specific terminal.
Terminal definitions are stored in databases on the system, and
users indicate what kind of terminal they are using by setting the
TERM environment variable (usually at login time). These
databases are handled differently under BSD and System V and are the
subject of the next section.
Programs use the name specified in the TERM environment variable as a key into the
system terminal definitions database. Under the BSD scheme, terminal
definitions are stored in the file /etc/termcap
; under System V, they are stored in the subdirectories
of the terminfo top-level subdirectory. Some systems provide both
facilities:
This section provides a brief overview of termcap and terminfo
entries. See the Nutshell ...