Content-type: text/html Man page of termcap

termcap

Section: Devices and Network Interfaces (4)
Index Return to Main Contents
 

NAME

termcap - Terminal capability database  

SYNOPSIS

/usr/share/lib/termcap  

DESCRIPTION

The termcap file is a database describing terminals used by tset and BSD curses. Terminals are described in the termcap database by specifying a set of capabilities that they have and by describing how operations are performed. Padding requirements and initialization sequences are also included.

Entries in the termcap database consist of a number of colon-separated fields. The first entry for each terminal includes all the names that are used for that terminal, separated by vertical bars (|). The first name is always two characters long and is used by older systems which store the terminal type in a 16-bit word in a system-wide database. The second name is the most common abbreviation for the terminal. The last name should be a long name, fully identifying the terminal. Between the second and last names, include any synonyms commonly used to refer to that terminal. All names but the first and last should be in lower case and contain no spaces; the last name can contain uppercase letters and spaces for readability.

Terminal names (except for the last verbose entry) should be chosen using certain conventions. The particular piece of hardware making up the terminal should have a root name chosen, such as vt100. This name should not contain hyphens. Any hardware modes or user preferences should be indicated by appending a hyphen and an indicator of the mode. Therefore, a vt100 in 132-column mode would be vt100-w. The following suffixes should be used where possible:

Suffix     Meaning                                   Example
-w         Wide mode (more than 80 columns)          vt100-w
-am        With automatic margins (usually default)  vt100-am
-nam       Without automatic margins                 vt100-nam
-n         Number of lines on the screen             aaa-60
-na        No arrow keys (leave them in local)       concept100-na
-np        Number of pages of memory                 concept100-4p
-rv        Reverse video                             concept100-rv
 

Capabilities

The characters in the Notes field in the table have the following meanings (more than one may apply to a capability): indicates numeric parameter(s) indicates that padding may be specified indicates that padding may be based on the number of lines affected indicates capability is obsolete

Capabilities marked as obsolete have no terminfo equivalents since they were considered useless, or are subsumed by other capabilities. New software should not rely on them at all.

NameTypeNotesDescription

aestr(P)End alternate character set
ALstr(NP*)Add n new blank lines
alstr(P*)Add new blank line
amboolTerminal has automatic margins
asstr(P)Start alternate character set
bcstr(o)Backspace if not ^H
blstr(P)Audible signal (bell)
bsbool(o)Terminal can backspace with ^H
btstr(P)Back tab
bwbool le (backspace) wraps from column 0 to last column
CCstrTerminal settable command character in prototype
cdstr(P*)Clear to end of display
cestr(P)Clear to end of line
chstr(NP)Set cursor column (horizontal position)
clstr(P*)Clear screen and home cursor
CMstr(NP)Memory-relative cursor addressing
cmstr(NP)Screen-relative cursor motion
conumNumber of columns in a line
crstr(P)Carriage return
csstr(NP)Change scrolling region (VT100)
ctstr(P)Clear all tab stops
cvstr(NP)Set cursor row (vertical position)
daboolDisplay may be retained above the screen
dBnum(o)Milliseconds of bs delay needed (default 0)
dbboolDisplay may be retained below the screen
DCstr(NP*)Delete n characters
dCnum(o)Milliseconds of cr delay needed (default 0)
dcstr(P*)Delete character
dFnum(o)Milliseconds of ff delay needed (default 0)
DLstr(NP*)Delete n lines
dlstr(P*)Delete line
dmstrEnter delete mode
dNnum(o)Milliseconds of nl delay needed (default 0)
DOstr(NP*)Move cursor down n lines
dostrDown one line
dsstrDisable status line
dTnum(o) Milliseconds of horizontal tab delay needed (default 0)
dVnum(o) Milliseconds of vertical tab delay needed (default 0)
ecstr(NP)Erase n characters
edstrEnd delete mode
eistrEnd insert mode
eoboolCan erase overstrikes with a blank
EPbool(o)Even parity
esboolEscape can be used on the status line
ffstr(P*)Hardcopy terminal page eject
fsstrReturn from status line
gnboolGeneric line type (that is, dialup, switch)
hcboolHardcopy terminal
HDbool(o)Half-duplex
hdstrHalf-line down (forward 1/2 linefeed)
hostr(P)Home cursor
hsboolHas extra ``status line''
hustrHalf-line up (reverse 1/2 linefeed)
hzboolCannot print ~s (Hazeltine)
i1-i3strTerminal initialization strings (terminfo only)
ICstr(NP*)Insert n blank characters
icstr(P*)Insert character
ifstrName of file containing initialization string
imstrEnter insert mode
inboolInsert mode distinguishes nulls
iPstr Pathname of program for initialization (terminfo only)
ipstr(P*)Insert pad after character inserted
isstrTerminal initialization string (termcap only)
itnumTabs initially every n positions
K1strSent by keypad upper left
K2strSent by keypad upper right
K3strSent by keypad center
K4strSent by keypad lower left
K5strSent by keypad lower right
k0-k9strSent by function keys 0-9
kAstrSent by insert-line key
kastrSent by clear-all-tabs key
kbstrSent by backspace key
kCstrSent by clear-screen or erase key
kDstrSent by delete-character key
kdstrSent by down-arrow key
kEstrSent by clear-to-end-of-line key
kestrOut of ``keypad transmit'' mode
kFstrSent by scroll-forward/down key
kHstrSent by home-down key
khstrSent by home key
kIstr Sent by insert-character or enter-insert-mode key
kLstrSent by delete-line key
klstrSent by left-arrow key
kMstrSent by insert key while in insert mode
kmboolHas a ``meta'' key (shift, sets parity bit)
kNstrSent by next-page key
knnum(o)Number of function (k0-k9) keys (default 0)
kostr(o)Termcap entries for other non-function keys
kPstrSent by previous-page key
kRstrSent by scroll-backward/up key
krstrSent by right-arrow key
kSstrSent by clear-to-end-of-screen key
ksstrPut terminal in ``keypad transmit'' mode
kTstrSent by set-tab key
ktstrSent by clear-tab key
kustrSent by up-arrow key
l0-l9strLabels on function keys if not ``fn''
LCbool(o)Lower-case only
LEstr(NP)Move cursor left n positions
lestr(P)Move cursor left one position
linumNumber of lines on screen or page
llstrLast line, first column
lmnumLines of memory if > li (0 means varies)
mastr(o)Arrow key map (used by vi version 2 only)
mbstrTurn on blinking attribute
mdstrTurn on bold (extra bright) attribute
mestrTurn off all attributes
mhstrTurn on half-bright attribute
miboolSafe to move while in insert mode
mkstrTurn on blank attribute (characters invisible)
mlstr(o)Memory lock on above cursor
mmstrTurn on ``meta mode'' (8th bit)
mostrTurn off ``meta mode''
mpstrTurn on protected attribute
mrstrTurn on reverse-video attribute
msboolSafe to move in standout modes
mustr(o)Memory unlock (turn off memory lock)
ncbool(o) No correctly-working cr (Datamedia 2500, Hazeltine 2000)
ndstrNon-destructive space (cursor right)
NLbool(o)\n is newline, not line feed
nlstr(o)Newline character if not \n
nsbool(o)Terminal is a CRT but does not scroll
nwstr(P)Newline (behaves like cr followed by do)
OPbool(o)Odd parity
osboolTerminal overstrikes
pbnumLowest baud where delays are required
pcstrPad character (default NUL)
pfstrTurn off the printer
pkstr Program function key n to type string s (terminfo only)
plstr Program function key n to execute string s (terminfo only)
pOstr(N)Turn on the printer for n bytes
postrTurn on the printer
psstrPrint contents of the screen
ptbool(o)Has hardware tabs (may need to be set with is)
pxstr Program function key n to transmit string s (terminfo only)
r1-r3str Reset terminal completely to sane modes (terminfo only)
rcstr(P)Restore cursor to position of last sc
rfstrName of file containing reset codes
RIstr(NP)Move cursor right n positions
rpstr(NP*)Repeat character c n times
rsstr Reset terminal completely to sane modes (termcap only)
sastr(NP)Define the video attributes
scstr(P)Save cursor position
sestrEnd standout mode
SFstr(NP*)Scroll forward n lines
sfstr(P)Scroll text up
sgnum Number of garbage chars left by so or se (default 0)
sostrBegin standout mode
SRstr(NP*)Scroll backward n lines
srstr(P)Scroll text down
ststrSet a tab in all rows, current column
tastr(P)Tab to next 8-position hardware tab stop
tcstrEntry of similar terminal - must be last
testrString to end programs that use termcap
tistrString to begin programs that use termcap
tsstr(N)Go to status line, column n
UCbool(o)Upper-case only
ucstrUnderscore one character and move past it
uestrEnd underscore mode
ugnum Number of garbage chars left by us or ue (default 0)
ulboolUnderline character overstrikes
UPstr(NP*)Move cursor up n lines
upstrUpline (cursor up)
usstrStart underscore mode
vbstrVisible bell (must not move cursor)
vestrMake cursor appear normal (undo vs/vi)
vistrMake cursor invisible
vsstrMake cursor very visible
vtnum Virtual terminal number (not supported on all systems)
wistr(N)Set current window
wsnumNumber of columns in status line
xbboolBeehive (f1=ESC, f2=^C)
xnboolNewline ignored after 80 cols (Concept)
xoboolTerminal uses xoff/xon (DC3/DC1) handshaking
xrbool(o)Return acts like ce cr nl (Delta Data)
xsboolStandout not erased by overwriting (Hewlett-Packard)
xtboolTabs ruin, magic so char (Teleray 1061)
xxbool(o)Tektronix 4025 insert-line
 

Sample Entry

The following sample entry, which describes the Concept-100, is among the more complex entries that one may find in a termcap file.

ca|concept100|c100|concept|c104|concept100-4p|HDS Concept-100:\            :al=3*\E^R:am:bl=^G:cd=16*\E^C:ce=16\E^U:cl=2*^L:cm=\Ea%+ %+ :\
           :co#80:.cr=9^M:db:dc=16\E^A:dl=3*\E^B:do=^J:ei=\E\200:eo:im=\E^P:in:\
           :ip=16*:is=\EU\Ef\E7\E5\E8\El\ENH\EK\E\200\Eo&\200\Eo\47\E:k1=\
           E5:\:k2=\E6:k3=\E7:kb=^h:kd=\E<:ke=\Ex:kh=\E?:kl=\E>:kr=\E=:ks=\EX:\
           :ku=\E;:le=^H:li#24:mb=\EC:me=\EN\200:mh=\EE:mi:mk=\EH:mp=\EI:\
           :mr=\ED:nd=\E=:pb#9600:rp=0.2*\Er%.%+ :se=\Ed\Ee:sf=^J:so=\EE\ED:\
           :.ta=8\t:te=\Ev \200\200\200\200\200\200\Ep\r\n:\
           :ti=\EU\Ev 8p\Ep\r:ue=\Eg:ul:up=\E;:us=\EG:\
           :vb=\Ek\200\200\200\200\200\200\200\200\200\200\200\200\200\200\
           EK:\:ve=\Ew:vs=\EW:vt#8:xn:\
           :bs:cr=^M:dC#9:dT#8:nl=^J:ta=^I:pt:

Entries can continue onto multiple lines by giving a \ as the last character of a line. Empty fields can be included for readability (here between the last field on a line and the first field on the next). Comments can be included on lines beginning with them with the pound sign (#).  

Types of Capabilities

There are three types of capabilities listed in the termcap file: Indicate particular features that the terminal has Specify the size of the display or the size of other attributes. Specify character sequences that can be used to perform particular terminal operations. All capabilities have two-letter codes. For instance, the fact that the Concept has automatic margins (that is, an automatic return and linefeed when the end of a line is reached) is indicated by the Boolean capability am in the Concept description.

Numeric capabilities are followed by the pound sign (#) character and a number. In the preceding example, co has the value 80 to indicate 80 columns for the Concept.

Finally, string-valued capabilities, such as ce (clear-to-end-of-line sequence), use a two-letter code followed by an equal sign (=) and the a descriptive string ending at the next colon (:). A delay in milliseconds may appear after the equal sign (=) in such a capability to cause padding characters to be supplied by tput after the remainder of the string is sent to provide this delay. The delay can be either a number or a number followed by an asterisk (*), for example, 20 or 16*. The asterisk indicates that the padding required is proportional to the number of lines affected by the operation, and the amount given is the per-affected-line padding required. (In the case of insert-character, however, the factor is still the number of lines affected. This value is always 1 unless the terminal has in and the software uses it.) When an asterisk is specified, it is sometimes useful to specify a delay n the form 3.5 to indicate a delay per line to tenths of milliseconds. (Only one decimal place is allowed.)

A number of escape sequences are provided in the string-valued capabilities for ease in encoding control characters. The string \E maps to an ESC character, ^x maps to a Control-x for any appropriate x, and the sequences \n, \r, \t, \b, and \f map to linefeed, return, tab, backspace, and formfeed, respectively. You can specify characters as three octal digits after a backslash (\). To specify the circumflex (^) or the backslash (\), use \^ or \\ respectively. If you need to include a colon (:) in a capability, you need to use the octal representation preceded by a backslash, for example \072. Similarly, to use the NUL character in a string capability, code it as \200. (The routines that deal with termcap use C strings and strip the high order bits of the output very late, so that a \200 ends up being the same as \000.

Sometimes individual capabilities must be commented out. To do this, put a period before the capability name. For example, see the first cr and ta in the preceding example.  

Preparing Descriptions

The most effective way to prepare a terminal description is by imitating the description of a similar terminal already in the termcap file and to build up a description gradually, using partial descriptions to check that they are correct.

Be aware that a very unusual terminal may expose deficiencies in the ability of the termcap file to describe it or because of problems with the editor. To easily test a new terminal description you are working on, you can put it in your home directory in a file called termcap so programs will look there before looking in /usr/share/lib/termcap.

You can also set the environment variable TERMPATH to a list of absolute file pathnames (separated by spaces or colons), one of which contains the description you are working on, and programs will search them in the order listed, and nowhere else. (See curs_termcap(3).) The TERMCAP environment variable is usually set to the termcap entry itself to avoid reading files when starting up a program.

To get the padding for insert-line right (if the terminal manufacturer did not document it), a severe test is to use vi to edit the /etc/passwd file at 9600 baud, delete roughly 16 lines from the middle of the screen, and then hit the u key several times quickly. If the display becomes confused, more padding is usually needed. A similar test can be used for insert-character.  

Basic Capabilities

The number of columns on each line of the display is given by the co numeric capability. If the display is a CRT, the number of lines on the screen is given by the li capability.

If the display wraps around to the beginning of the next line when the cursor reaches the right margin, it should have the am capability. If the terminal can clear its screen, the code to do this is given by the cl string capability. If the terminal overstrikes (rather than clearing the position when a character is overwritten), it should have the os capability.

If the terminal is a printing terminal, with no soft copy unit, include both the hc and os capabilities. (The os capability applies to storage scope terminals, such as the Tektronix 4010 series, as well as to hard copy and APL terminals.) If there is a code to move the cursor to the left edge of the current row, specify this as cr. (Normally this code is the carriage-return control sequence, ^M.) If there is a code to produce an audible signal (bell, beep, and so on) specify this characteristic as bl.

If there is a code (such as backspace) to move the cursor one position to the left, specify that capability as le. Similarly, use the following codes to move to the right, up, and down: nd, up, and do. These local cursor motions should not alter the text they pass over; for example, you would not normally use nd unless the terminal has the os capability, because the space would erase the character moved over.

Note that the local cursor motions encoded in the termcap file have undefined behavior at the left and top edges of a CRT display. Programs should never attempt to backspace around the left edge unless the terminal capability bw is specified and never attempt to go up off the top using local cursor motions.

In order to scroll text up, a program goes to the bottom left corner of the screen and sends the sf (index) string. To scroll text down, a program goes to the top left corner of the screen and sends the sr (reverse index) string. The strings sf and sr have undefined behavior when not on their respective corners of the screen. Parameterized versions of the scrolling sequences are SF and SR, which have the same semantics as sf and sr, except that they take one parameter and scroll that many lines. They also have undefined behavior except at the appropriate corner of the screen.

The am capability tells whether the cursor stays at the right edge of the screen when text is output there, but does not necessarily apply to nd from the last column. Leftward local motion is defined from the left edge only when bw is given; then an le from the left edge will move to the right edge of the previous row. This is useful for drawing a box around the edge of the screen, for example.

If the terminal has switch-selectable automatic margins, the termcap description usually assumes that this feature is on, that is, am. If the terminal has a command that moves to the first column of the next line, that command can be given as nl (newline). It is permissible for this to clear the remainder of the current line, so if the terminal has no correctly-working CR and LF, it may still be possible to craft a working nw out of one or both of them.

These capabilities suffice to describe hardcopy and "glass-tty" terminals. Thus, the Teletype model 33 is described as follows:

T3|tty33|33|tty|Teletype model 33:\
     :bl=^G:co#72:cr=^M:do=^J:hc:os:

The Lear Siegler ADM is described as follows:

l3|adm3|3|LSI ADM-3:\
     :am:bl=^G:cl=^Z:co#80:cr=^M:do=^J:le=^H:li#24:sf=^J:

 

Parameterized Strings

Cursor addressing and other strings requiring parameters are described by a parameterized string capability, with escapes similar to those used with printf %x in it, while other characters are passed through unchanged. For example, to address the cursor, the cm capability is specified using two parameters: the row and column to move to. (Rows and columns are numbered from zero and refer to the physical screen visible to the user, not to any unseen memory. If the terminal has memory-relative cursor addressing, that can be indicated by an analogous CM capability.)

The % encodings have the following meanings:


    %%    output `%'
    %d    output value as in printf %d
    %2    output value as in printf %2d
    %3    output value as in printf %3d
    %.    output value as in printf %c
    %+x    add x to value, then do %.
    %>xy    if value > x then add y, no output
    %r    reverse order of two parameters, no output
    %i    increment by one, no output
    %n    exclusive-or all parameters with 0140 (Datamedia 2500)
    %B    BCD (16*(value/10)) + (value%10), no output
    %D    Reverse coding (value - 2*(value%16)), no output (Delta Data)

Consider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needs to be sent "\E&a12c03Y" padded for 6 milliseconds. Note that the order of the row and column coordinates is reversed here and that the row and column are sent as two-digit integers. Thus its cm capability is "cm=6\E&%r%2c%2Y".

The Microterm ACT-IV needs the current row and column sent simply encoded in binary preceded by a ^T "cm=^T%.%.". Terminals that use "%." need to be able to backspace the cursor (le) and to move the cursor up one line on the screen (up). This is necessary because it is not always safe to transmit \n, ^D and \r, as the system may change or discard them. (Programs using termcap must set terminal modes so that tabs are not expanded, so \t is safe to send. This turns out to be essential for the Ann Arbor 4080.)

A final example is the Lear Siegler ADM-3a, which offsets row and column by a blank character, thus "cm=\E=%+ %+".

Row or column absolute cursor addressing can be given as single parameter capabilities ch (horizontal position absolute) and cv (vertical position absolute). Sometimes these are shorter than the more general two-parameter sequence (as with the Hewlett-Packard 2645) and can be used in preference to cm. If there are parameterized local motions (that is, move n positions to the right) these can be given as DO, LE, RI, and UP with a single parameter indicating how many positions to move. These are primarily useful if the terminal does not have cm, such as the Tektronix 4025.  

Cursor Motions

If the terminal has a fast way to home the cursor (to the very upper left corner of the screen), this can be given as ho. Similarly, a fast way of getting to the lower left-hand corner can be given as ll; this may involve going up with up from the home position, but a program should never do this itself (unless ll does), because it can make no assumption about the effect of moving up from the home position. Note that the home position is the same as cursor address (0,0): to the top left corner of the screen, not of memory. (Therefore, the "\EH" sequence on Hewlett-Packard terminals cannot be used for ho.)  

Area Clears

If the terminal can clear from the current position to the end of the line, leaving the cursor where it is, this should be given as ce. If the terminal can clear from the current position to the end of the display, this should be given as cd. The cd capability must only be invoked from the first column of a line. (Therefore, it can be simulated by a request to delete a large number of lines, if a true cd is not available.  

Insert/Delete Line

If the terminal can open a new blank line before the line containing the cursor, this should be given as al; this must be invoked only from the first position of a line. The cursor must then appear at the left of the newly blank line. If the terminal can delete the line that the cursor is on, this should be given as dl; this must only be used from the first position on the line to be deleted. Versions of al and dl which take a single parameter and insert or delete that many lines can be given as AL and DL. If the terminal has a settable scrolling region (like the VT100), the command to set this can be described with the cs capability, which takes two parameters: the top and bottom lines of the scrolling region. The cursor position is, alas, undefined after using this command.

It is possible to get the effect of insert or delete line using this command --- the sc and rc (save and restore cursor) commands are also useful. Inserting lines at the top or bottom of the screen can also be done using sr or sf on many terminals without a true insert/delete line, and is often faster even on terminals with those features.

If the terminal has the ability to define a window as part of memory which all commands affect, it should be given as the parameterized string wi. The four parameters are the starting and ending lines in memory and the starting and ending columns in memory, in that order. (This termcap capability is described for completeness. It is unlikely that any program using termcap will support it.)

If the terminal can retain display memory above the screen, then the da capability should be given; if display memory can be retained below, db should be specified. These indicate that deleting a line or scrolling may bring non-blank lines up from below or that scrolling back with sr may bring down non-blank lines.  

Insert/Delete Character

There are two basic kinds of intelligent terminals with respect to insert/delete character that can be described using termcap. The most common insert/delete character operations affect only the characters on the current line and shift characters off the end of the line rigidly. Other terminals, such as the Concept-100 and the Perkin Elmer Owl, make a distinction between typed and untyped blanks on the screen, shifting upon an insert or delete only to an untyped blank on the screen which is either eliminated or expanded to two untyped blanks.

You can determine the kind of terminal you have by clearing the screen then typing text separated by cursor motions. Type "abc    def" using local cursor motions (not spaces) between the "abc" and the "def Then position the cursor before the "abc" and put the terminal in insert mode. If typing characters causes the rest of the line to shift rigidly and characters to fall off the end, your terminal does not distinguish between blanks and untyped positions. If the "abc" shifts over to the "def" which then move together around the end of the current line and onto the next as you insert, you have the second type of terminal and should give the capability in, which stands for "insert null". Although these are two logically separate attributes (one line as opposed to multi-line insert mode, and special treatment of untyped spaces), almost all terminals can be described with the single attribute.

The termcap file can describe both terminals that have an insert mode and terminals that send a simple sequence to open a blank position on the current line. Specify as im the sequence to get into insert mode. Specify as ei the sequence to leave insert mode. Then, specify as ic any sequence that needs to be sent just before each character to be inserted. Most terminals with a true insert mode will not use ic; terminals that use a sequence to open a screen position should specify it here. (If your terminal has both, insert mode is usually preferable to ic. Do not specify both unless the terminal actually requires both to be used in combination.)

If post-insert padding is needed, specify this as a number of milliseconds in ip (a string option). Any other sequence that may need to be sent after insertion of a single character can also be given in ip. If your terminal needs to be placed into an "insert mode" and needs a special code preceding each inserted character, both im/ei and ic can be given, and both will be used. The IC capability, with one parameter n, will repeat the effects of ic n times.

It is occasionally necessary to move around while in insert mode to delete characters on the same line (for example, if there is a tab after the insertion position). If your terminal allows motion while in insert mode, you can give the capability mi to speed up inserting in this case. Omitting mi will affect only speed. Some terminals (notably Datamedia's) cannot have mi because of the way their insert mode works.

Finally, you can specify dc to delete a single character, DC with one parameter n to delete n characters, and delete mode by giving dm and ed to enter and exit delete mode (which is any mode the terminal needs to be placed in for dc to work.)  

Highlighting, Underlining, and Visible Bells

If your terminal has one or more kinds of display attributes, these can be represented in a number of different ways. You should choose one display form as "standout mode" representing a good high-contrast, easy-on-the-eyes format for highlighting error messages and other attention getters. (If you have a choice, reverse video plus half-bright is good, or reverse video alone.) The sequences to enter and exit standout mode are given as so and se respectively. If the code to change into or out of standout mode leaves one or even two blank spaces or stray characters on the screen, as the TVI 912 and Teleray 1061 do, specify sg to tell how many characters are left.

Codes to begin underlining and end underlining can be given as us and ue, respectively. Underline mode change garbage is specified by ug, similar to sg. If the terminal has a code to underline the current character and move the cursor one position to the right, such as the Microterm Mime, this can be specified as uc.

Other capabilities to enter various highlighting modes include mb (blinking), md (bold or extra bright), mh (dim or half-bright), mk (blanking or invisible text), mp (protected), mr (reverse video), me (turn off all attribute modes), as (enter alternate character set mode), and ae (exit alternate character set mode). Turning on any of these modes singly may or may not turn off other modes.

If there is a sequence to set arbitrary combinations of mode, this should be specified as sa (set attributes), taking 9 parameters. Each parameter is either 0 or 1, as the corresponding attributes is on or off. The 9 parameters are, in order: standout, underline, reverse, blink, dim, bold, blank, protect, and alternate character set. Not all modes need be supported by sa; only those for which corresponding attribute commands exist. (It is unlikely that a program using termcap will support this capability, which is defined for compatibility with terminfo.)

Terminals with the "magic cookie" anomalies (sg and ug) rather than maintaining extra attribute bits for each character cell, instead deposit special "cookies", or other kinds of stray characters, when they receive mode-setting sequences, which affect the display algorithm.

Some terminals, such as the Hewlett-Packard 2621, automatically leave standout mode when they move to a new line or when the cursor is addressed. Programs using standout mode should exit standout mode on such terminals before moving the cursor or sending a newline. On terminals where this is not a problem, the ms capability should be present to say that this overhead is unnecessary.

If the terminal has a way of flashing the screen to indicate an error quietly (a bell replacement), this capability can be specified using vb; it must not move the cursor.

If the cursor needs to be made more visible than normal when it is not on the bottom line (to change, for example, a non-blinking underline into an easier-to-find block or blinking underline), specify this sequence as vs. If there is a way to make the cursor completely invisible, specify that as vi. The capability ve, which undoes the effects of both of these modes, should also be specified.

If your terminal correctly displays underlined characters (with no special codes needed) even though it does not overstrike, you should give the capability ul. If overstrikes are erasable with a blank, this should be indicated by specifying eo.  

Keypad

If the terminal has a keypad that transmits codes when the keys are pressed, this information can be specified. Note that it is not possible to handle terminals where the keypad only works in local mode (this applies, for example, to the unshifted Hewlett-Packard 2621 keys). If the keypad can be set to transmit or not transmit, give these codes as ks and ke. Otherwise the keypad is assumed to always transmit. The codes sent by the left-arrow, right-arrow, up-arrow, down-arrow, and home keys can be given as kl, kr, ku, kd, and kh, respectively.

If there are function keys such as f0, f1, ..., f9, the codes they send can be given as k0, k1, "" ..., k9. If these keys have labels other than the default f0 through f9, the labels can be given as 10, 11, "" ..., 19.

The codes transmitted by certain other special keys can be specified: kH (home down), kb (backspace), ka (clear all tabs), kt (clear the tab stop in this column), kC (clear screen or erase), kD (delete character), kL (delete line), kM (exit insert mode), kE (clear to end of line), kS (clear to end of screen), kI (insert character or enter insert mode), kA (insert line), kN (next page), kP (previous page), kF (scroll forward/down), kR (scroll backward/up), and kT (set a tab stop in this column). In addition, if the keypad has a 3 by 3 array of keys including the four arrow keys, then the other five keys can be given as K1, K2, K3, K4, and K5. These keys are useful when the effects of a 3 by 3 directional pad are needed. The obsolete ko capability formerly used to describe "other" function keys has been completely supplanted by the above capabilities.

The ma entry is also used to indicate arrow keys on terminals that have single-character arrow keys. It is obsolete but still in use in Version 2 of vi which must be run on some minicomputers due to memory limitations. This field is redundant with kl, kr, ku, kd, and kh. It consists of groups of two characters. In each group, the first character is what an arrow key sends, and the second character is the corresponding vi command. These commands are h for kl, j for kd, k for ku, l for kr, and h for kh. For example, the Mime would have "ma=^Hh^Kj^Zk^Xl" indicating arrow keys left (^H), down (^K), up (^Z), and right (^X). (There is no home key on the Mime.)  

Tabs and Initialization

If the terminal needs to be in a special mode when running a program that uses these capabilities, the codes to enter and exit this mode can be given as ti and te. This arises, for example, from terminals like the Concept with more than one page of memory. If the terminal has only memory-relative cursor addressing and not screen-relative cursor addressing, a screen-sized window must be fixed into the display for cursor addressing to work properly. This is also used for the Tektronix 4025, where ti sets the command character to be the one used by termcap.

Other capabilities include is, an initialization string for the terminal, and if, the name of a file containing long initialization strings. These strings are expected to set the terminal into modes consistent with the rest of the termcap description. They are normally sent to the terminal by the tset program each time the user logs in. They will be printed in the following order: is; setting tabs using ct and st; and finally if. (The terminfo file uses i1-i2 instead of is and runs the program iP and prints i3 after the other initializations.) A pair of sequences that does a harder reset from a totally unknown state can be analogously given as rs and if. These strings are output by the reset program, which is used when the terminal gets into a wedged state. (The terminfo program uses r1-r3 instead of rs.)

Commands are normally placed in rs and rf only if they produce annoying effects on the screen and are not necessary when logging in. For example, the command to set the VT100 into 80-column mode would normally be part of is, but it causes an annoying glitch of the screen and is not normally needed since the terminal is usually already in 80-column mode.

If the terminal has hardware tabs, the command to advance to the next tab stop can be given as ta (usually ^I). A backtab command which moves leftward to the previous tab stop can be given as bt. By convention, if the terminal driver modes indicate that tab stops are being expanded by the computer rather than being sent to the terminal, programs should not use ta or bt even if they are present, since the user may not have the tab stops properly set. If the terminal has hardware tabs that are initially set every n positions when the terminal is powered up, the numeric parameter it is given, showing the number of positions between tab stops. This is normally used by the tset command to determine whether to set the driver mode for hardware tab expansion, and whether to set the tab stops. If the terminal has tab stops that can be saved in nonvolatile memory, the termcap description can assume that they are properly set.

If there are commands to set and clear tab stops, they can be given as ct (clear all tab stops) and st (set a tab stop in the current column of every row). If a more complex sequence is needed to set the tabs than can be described by this, the sequence can be placed in is or if.  

Delays

Certain capabilities control padding in the terminal driver. These are primarily needed by hardcopy terminals and are used by the tset program to set terminal driver modes appropriately. Delays embedded in the capabilities cr, sf, le, ff, and ta will cause the appropriate delay bits to be set in the terminal driver. If pb (padding baud rate) is given, these values can be ignored at baud rates below the value of pb. For systems based on 4.2BSD tset, the delays are given as numeric capabilities dC, dN, dB, dF, and dT instead.  

Miscellaneous

If the terminal requires other than a NUL (zero) character as a pad, this can be given as pc. Only the first character of the pc string is used.

If the terminal has commands to save and restore the position of the cursor, specify them as sc and rc.

If the terminal has an extra status line that is not normally used by software, this fact can be indicated. If the status line is viewed as an extra line below the bottom line, then the capability hs should be specified. Special strings to go to a position in the status line and to return from the status line can be given as ts and fs. (The fs capability must leave the cursor position in the same place that it was before ts. If necessary, the sc and rc strings can be included in ts and fs to get this effect.) The ts capability takes one parameter, which is the column number of the status line to which the cursor is to be moved. If escape sequences and other special commands such as tab work while in the status line, the flag es can be specified. A string that turns off the status line (or otherwise erases its contents) should be specified as ds. The status line is normally assumed to be the same width as the rest of the screen, that is, co. If the status line is a different width (possibly because the terminal does not allow an entire line to be loaded), then its width in columns can be indicated with the numeric parameter ws.

If the terminal can move up or down half a line, this can be indicated with hu (half-line up) and hd (half-line down). This is primarily useful for superscripts and subscripts on hardcopy terminals. If a hardcopy terminal can eject to the next page (form feed), specify this as ff (usually ^L).

If there is a command to repeat a given character a given number of times (to save time transmitting a large number of identical characters), this can be indicated with the parameterized string rp. The first parameter is the character to be repeated and the second is the number of times to repeat it. (This is a terminfo feature that is unlikely to be supported by a program that uses termcap.)

If the terminal has a settable command character, such as the Tektronix 4025, this can be indicated with CC. A prototype command character is chosen which is used in all capabilities. This character is given in the CC capability to identify it. The following convention is supported on some UNIX systems: The environment is to be searched for a CC variable, and if found, all occurrences of the prototype character are replaced by the character in the environment variable. This use of the CC environment variable is a very bad idea, as it conflicts with make(1).

Terminal descriptions that do not represent a specific kind of known terminal, such as switch, dialup, patch, and network, should include the gn (generic) capability so that programs can complain that they do not know how to talk to the terminal. (This capability does not apply to virtual terminal descriptions for which the escape sequences are known.)

If the terminal uses xoff/xon (DC3/DC1) handshaking for flow control, specify xo. Padding information should still be included so that routines can make better decisions about costs, but actual pad characters will not be transmitted.

If the terminal has a meta key which acts as a shift key setting the eighth bit of any character transmitted, this fact can be indicated with km. Otherwise, software will assume that the 8th bit is parity and it will usually be cleared. If strings exist to turn this meta mode on and off, they can be given as mm and mo.

If the terminal has more lines of memory than will fit on the screen at once, the number of lines of memory can be indicated with lm. An explicit value of 0 indicates that the number of lines is not fixed, but that there is still more memory than fits on the screen.

If the terminal is one of those supported by the UNIX system virtual terminal protocol, the terminal number can be specified as vt.

Media copy strings which control an auxiliary printer connected to the terminal can be given as follows: Print the contents of the screen. Turn off the printer. Turn on the printer.

When the printer is on, all text sent to the terminal will be sent to the printer. It is undefined whether the text is also displayed on the terminal screen when the printer is on. A variation, pO, takes one parameter and leaves the printer on for as many characters as the value of the parameter, then turns the printer off. The parameter should not exceed 255. All text, including pf, is transparently passed to the printer while pO is in effect.

Strings to program function keys can be specified as pk, pl, and px. Each of these strings takes two parameters: the function key number to program (from 0 to 9) and the string to program it with. Function key numbers out of this range may program undefined keys in a terminal-dependent manner. The differences among the capabilities are as follows: Causes pressing the given key to be the same as the user typing the given string. Causes the string to be executed by the terminal in local mode. Causes the string to be transmitted to the computer.

Unfortunately, due to lack of a definition for string parameters in termcap, only terminfo supports these capabilities.  

Cautions

Hazeltine terminals, which do not allow tilde (~) characters to be displayed, should indicate hz.

The nc capability, now obsolete, formerly indicated Datamedia terminals, which echo \r \n for carriage return then ignore a following linefeed.

Terminals that ignore a linefeed immediately after an am wrap, such as the Concept, should indicate xn.

If ce is required to get rid of standout (instead of merely writing normal text on top of it), xs should be specified.

Teleray terminals, where tabs turn all characters moved over to blanks, should indicate xt (destructive tabs). This glitch is also taken to mean that it is not possible to position the cursor on top of a "magic cookie", and that to erase standout mode it is necessary to use delete and insert line.

The Beehive Superbee, which is unable to correctly transmit the ESC or ^C characters, has xb, indicating that the f1 key is used for ESC and the f2 key for ^C. (Only certain Superbees have this problem, depending on the ROM.)

Other specific terminal problems may be corrected by adding more capabilities of the form xx.

Note

In UNIX System V Release 2.0, termcap was replaced by terminfo. If you are making a transition, avoid using any capabilities marked as obsolete.

Lines and columns are now stored by the kernel as well as in the termcap entry. Most programs now use the kernel information primarily; the information in this file is used only if the kernel does not have any information.

The total length of a single entry (excluding only escaped newlines) cannot exceed 1024 bytes, including a null terminator.

Not all programs support all entries.

 

Similar Terminals

If there are two very similar terminals, one can be defined as being like the other with certain exceptions. The string capability tc can be specified with the name of the similar terminal. This capability must be last, and the combined length of the entries must not exceed 1024 bytes, including a null terminator. The capabilities given before tc override those in the terminal type invoked by tc. A capability can be canceled by placing xx@ to the left of the tc invocation, where xx is the capability. For example, the following entry defines a "2621-nl" that does not have the ke or ke capabilities, hence does not turn on the function key labels when in visual mode.
     hn|2621-nl:ks@:ke@:tc=2621:

This is useful for different modes for a terminal, or for different user preferences.  

FILES

File containing terminal descriptions  

RELATED INFORMATION

tset(1), curses(3), printf(3), curs_termcap(3), termcap(3x), terminfo(4) delim off


 

Index

NAME
SYNOPSIS
DESCRIPTION
Capabilities
Sample Entry
Types of Capabilities
Preparing Descriptions
Basic Capabilities
Parameterized Strings
Cursor Motions
Area Clears
Insert/Delete Line
Insert/Delete Character
Highlighting, Underlining, and Visible Bells
Keypad
Tabs and Initialization
Delays
Miscellaneous
Cautions
Similar Terminals
FILES
RELATED INFORMATION

This document was created by man2html, using the manual pages.
Time: 02:40:02 GMT, October 02, 2010