Next: , Up: Termcap   [Contents][Index]


16.1 Choosing the termcap entry for a window

Usually screen tries to emulate as much of the VT100/ANSI standard as possible. But if your terminal lacks certain capabilities the emulation may not be complete. In these cases screen has to tell the applications that some of the features are missing. This is no problem on machines using termcap, because screen can use the $TERMCAP variable to customize the standard screen termcap.

But if you do a rlogin on another machine or your machine supports only terminfo this method fails. Because of this screen offers a way to deal with these cases. Here is how it works:

When screen tries to figure out a terminal name for itself, it first looks for an entry named screen.term, where term is the contents of your $TERM variable. If no such entry exists, screen tries ‘screen’ (or ‘screen-w’, if the terminal is wide (132 cols or more)). If even this entry cannot be found, ‘vt100’ is used as a substitute.

The idea is that if you have a terminal which doesn’t support an important feature (e.g. delete char or clear to EOS) you can build a new termcap/terminfo entry for screen (named ‘screen.dumbterm’) in which this capability has been disabled. If this entry is installed on your machines you are able to do a rlogin and still keep the correct termcap/terminfo entry. The terminal name is put in the $TERM variable of all new windows. screen also sets the $TERMCAP variable reflecting the capabilities of the virtual terminal emulated. Furthermore, the variable $WINDOW is set to the window number of each window.

The actual set of capabilities supported by the virtual terminal depends on the capabilities supported by the physical terminal. If, for instance, the physical terminal does not support underscore mode, screen does not put the ‘us’ and ‘ue’ capabilities into the window’s $TERMCAP variable, accordingly. However, a minimum number of capabilities must be supported by a terminal in order to run screen; namely scrolling, clear screen, and direct cursor addressing (in addition, screen does not run on hardcopy terminals or on terminals that over-strike).

Also, you can customize the $TERMCAP value used by screen by using the termcap command, or by defining the variable $SCREENCAP prior to startup. When the latter defined, its value will be copied verbatim into each window’s $TERMCAP variable. This can either be the full terminal definition, or a filename where the terminal ‘screen’ (and/or ‘screen-w’) is defined.

Note that screen honors the terminfo command if the system uses the terminfo database rather than termcap. On such machines the $TERMCAP variable has no effect and you must use the dumptermcap command (see Write out the window’s termcap entry) and the tic program to generate terminfo entries for screen windows.

When the boolean ‘G0’ capability is present in the termcap entry for the terminal on which screen has been called, the terminal emulation of screen supports multiple character sets. This allows an application to make use of, for instance, the VT100 graphics character set or national character sets. The following control functions from ISO 2022 are supported: ‘lock shift G0’ (‘SI’), ‘lock shift G1’ (‘SO’), ‘lock shift G2’, ‘lock shift G3’, ‘single shift G2’, and ‘single shift G3’. When a virtual terminal is created or reset, the ASCII character set is designated as ‘G0’ through ‘G3’. When the ‘G0’ capability is present, screen evaluates the capabilities ‘S0’, ‘E0’, and ‘C0’ if present. ‘S0’ is the sequence the terminal uses to enable and start the graphics character set rather than ‘SI’. ‘E0’ is the corresponding replacement for ‘SO’. ‘C0’ gives a character by character translation string that is used during semi-graphics mode. This string is built like the ‘acsc’ terminfo capability.

When the ‘po’ and ‘pf’ capabilities are present in the terminal’s termcap entry, applications running in a screen window can send output to the printer port of the terminal. This allows a user to have an application in one window sending output to a printer connected to the terminal, while all other windows are still active (the printer port is enabled and disabled again for each chunk of output). As a side-effect, programs running in different windows can send output to the printer simultaneously. Data sent to the printer is not displayed in the window. The info command displays a line starting with ‘PRIN’ while the printer is active.

Some capabilities are only put into the $TERMCAP variable of the virtual terminal if they can be efficiently implemented by the physical terminal. For instance, ‘dl’ (delete line) is only put into the $TERMCAP variable if the terminal supports either delete line itself or scrolling regions. Note that this may provoke confusion, when the session is reattached on a different terminal, as the value of $TERMCAP cannot be modified by parent processes. You can force screen to include all capabilities in $TERMCAP with the ‘-a’ command-line option (see Invoking Screen).

The "alternate screen" capability is not enabled by default. Set the altscreen .screenrc command to enable it.


Next: Write out the window’s termcap entry, Up: Termcap   [Contents][Index]