|
|
You have been given a brief look at the main components of screen management. This section will complete the overview by making you familiar with the other components of this system.
Components of the screen management system
Component | Brief description |
---|---|
terminfo
database | Files found under /usr/share/lib/terminfo/?/; these files contain compiled terminal descriptions. ? is the first letter of the terminal name, and is the terminal name. |
tic(1M) | terminfo(4) defines terminal description source files. tic compiles them into terminfo database files. |
infocmp(1M) | A routine that prints and compares compiled terminfo description files. |
captoinfo(1M) | A routine that converts old termcap files to terminfo database files. |
terminfo(4) | Defines both the terminfo database files and the routines used to manipulate and instantiate the strings of data in those files. |
tput(1) | A terminfo routine that causes a string from the terminfo database to be sent to the terminal, thus setting one or more parameters. |
curses(3ocurses) | A library of C routines that uses information in the terminfo database. The routines are terminal independent. They optimize cursor movement and allow for the easy programming of screen handling code. |
Other manual pages to read | Intro(3S), profile(4), term(4) |
The terminfo database has already been described as one of the main
components of the screen management system.
The rules for creating a terminal description source file are in the
manual page
terminfo(4).
The source file is then compiled using tic.
Unless you have created a shell environment variable called
TERMINFO that indicates a
different path, tic will place the compiled description
file into the proper directory under
/usr/share/lib/terminfo
(provided that you have permission to create or
overwrite files in that directory).
To use tic simply type:
tic filename
You may use the -v option to get a running commentary. An integer from 1 to 10 may follow the option (no space) to set the level of verbosity. The default is 1.
The system uses the shell environment variable TERMINFO to find the terminal description files. Initializing a terminal will cause TERMINFO to be set to null and then be converted to /usr/share/lib/terminfo unless you have already set it to some other path ($HOME/bin, for example). The system will look for the definition of a specific terminal under $TERMINFO/?/, where ? is the first letter of the terminal name, and is the terminal name.
Once a terminal description file has been compiled, it is no longer human readable. The routine infocmp translates a compiled description file back to source statements. Invoking the command without arguments will print out the description of the terminal defined by the shell environment variable TERM. A single argument is taken as the name of a terminal you want to see the source description for. With no options declared (or -I), you will see descriptions as defined in terminfo(4). There are options for seeing the C variable names (-L), the old termcap names (-C), and all output in termcap format (-r).
If two arguments are given, infocmp assumes they identify two descriptions you want to compare. If no options are given (or -d), the differences are printed. You may also ask for a list of capabilities that the two have in common (-c) or a list of capabilities that neither describes (-n). In all of the above cases, the output lists the Boolean fields first, the numeric fields second, and the strings third.
infocmp also has options to print, trace, sort, compare files in two different directories, and output a source file derived from the union of two or more compiled description files. For more information consult the infocmp manual page.
Early versions of the UNIX system used a different method of describing terminals, called termcap. You can convert a termcap file to a terminfo file by using captoinfo. If the command is invoked with no arguments, the shell environment variable TERMCAP is used to get the path and the shell environment variable TERM to get the terminal. If TERMCAP is null, the routine tries to convert /usr/share/lib/termcap. If a file name is given as an option, that is the file that will be converted. The output is to standard out, and may be piped. Options include a trace mode (-v), one field to a line output (-l), and changing the output width (-w).
One of the definitions given earlier for terminfo was that it is a group of routines within curses that allow you to manipulate the data in a terminal description file. This small library of routines is documented in this guide and in the curses(3ocurses) manual pages. The command tput(1) will allow you to perform many of these manipulations from the command line or in a shell script.
tput can always be given the -Tterminaltype option, but does not need it if the shell environment variable TERM is set. It can be given init, reset, or longname as special arguments. These initialize, reset, and print out the name of the terminal, respectively. Finally, you can use the name of a terminfo(4) terminal attribute or capability (called a ``capname'') as an argument. These capabilities can fall into three categories; Boolean, numeric, and strings. If the ``capname'' you specify is a string, you may include, as an argument, a list of parameters to insert into coded places in the string (instantiation).
This completes the overview of the screen management system. More detailed information is to be found in ``Basic ETI programming''. If you elect to skip this and go directly to the manual pages, remember that the examples in ``ETI program examples'' might still prove useful.