.TH TERMCAP UCB 4/8/79 UCB .SH NAME termcap \- terminal capability data base .SH SYNOPSIS /etc/termcap .SH DESCRIPTION .I Termcap is a data base describing terminals used primarily by .IR ex (UCB) and .IR vi (UCB), and also by .IR tset (UCB). Terminals are described in .I termcap by giving a set of capabilities which they have, and by describing how operations are performed. Padding requirements and initialization sequences are included in .I termcap. .PP Entries in .I termcap consist of a number of `:' separated fields. The first entry for each terminal gives the names which are known for the terminal, separated by `|' characters. The first name is always 2 characters long and is used by older version 6 systems which store the terminal type in a 16 bit word in a systemwide data base. The second name given is the most common abbreviation for the terminal, and the last name given should be a long name fully identifying the terminal. The second name should contain no blanks; the last name may well contain blanks for readability. .PP The following entry, which describes the Concept\-100, is among the more complex entries in the .I termcap file as of this writing. .PP .nf c1|c100|concept100:is=\eEU\eEf\eE7\eE5\eE8\eEl\eENH\eEK\eE\e200\eEo&\e200:\e :al=3*\eE^R:am:bs:cd=16*\eE^C:ce=16\eE^S:cl=2*^L:cm=\eEa%+ %+ :co#80:\e :dc=16\eE^A:dl=3*\eE^B:ei=\eE\e200:eo:im=\eE^P:in:ip=16*:li#24:mi:nd=\eE=:\e :se=\eEd\eEe:so=\eED\eEE:ta=8\et:ul:up=\eE;:vb=\eEk\eEK:xn: .fi .PP Note that entries may continue onto multiple lines by giving a \e as the last character of a line, and that empty fields may be included for readability (here between the last field on a line and the first field on the next). Capabilities in .I termcap are of three types: Boolean capabilities which indicate that the terminal has some particular feature, numeric capabilities giving the size of the terminal or the size of particular delays, and string capabilities, which give a sequence which can be used to perform particular terminal operations. .PP All capabilities have two letter codes. For instance, the fact that the Concept has ``automatic margins'' (i.e. an automatic return and linefeed when the end of a line is reached) is indicated by the capability \fBam\fR. Hence the description of the Concept includes \fBam\fR. Numeric capabilities are followed by the character `#' and then the value. Thus \fBco\fR which indicates the number of columns the terminal has gives the value `80' for the Concept. .PP Finally, string valued capabilities, such as \fBce\fR (clear to end of line sequence) are given by the two character code, an `=', and then a string ending at the next following `:'. A delay in milliseconds may appear after the `=' in such a capability, and padding characters are supplied by the editor after the remainder of the string is sent to provide this delay. The delay can be either a integer, e.g. `20', or an integer followed by an `*', i.e. `3*'. A `*' indicates that the padding required is proportional to the number of lines affected by the operation, and the amount given is the per-affected-unit padding required. When a `*' is specified, it is sometimes useful to give a delay of the form `3.5' specify a delay per unit to tenths of milliseconds. .PP A number of escape sequences are provided in the string valued capabilities for easy encoding of characters there. A \fB\eE\fR maps to an \s-2ESCAPE\s0 character, \fB^x\fR maps to a control-x, and the sequences \fB\en \er \et \eb \ef\fR give a newline, return, tab, backspace and formfeed. Finally, characters may be given as three octal digits after a \fB\e\fR, and the characters \fB^\fR and \fB\fR may be given as \fB\e^\fR and \fB\e\e\fR. If it is necessary to place a \fB:\fR in a capability it must be escaped in octal as \fB\e072\fR. If it is necessary to place a null character in a string capability it must be encoded as \fB\e200\fR. The routines which deal with .I termcap use C strings, and strip the high bits of the output very late so that a \fB\e200\fR comes out as a \fB\e000\fR would. .PP We now outline how to prepare descriptions of terminals. The most effective way to prepare a terminal description is by imitating the description of a similar terminal in .I termcap and to build up a description gradually, using partial descriptions with .I ex to check that they are correct. Be aware that a very unusual terminal may expose deficiencies in the ability of the .I termcap file to describe it or bugs in .I ex. To easily test a new terminal description you can set the environment variable TERMCAP to a pathname of a file containing the description you are working on and the editor will look there rather than in .I /etc/termcap. (This only works on version 7 systems.) .PP .B Basic capabilities .PP The number of columns on each line for the terminal is given by the \fBco\fR numeric capability. If the terminal is a \s-2CRT\s0, then the number of lines on the screen is given by the \fBli\fR capability. If the terminal wraps around to the beginning of the next line when it reaches the right margin, then it should have the \fBam\fR capability. If the terminal can clear its screen, then this is given by the \fBcl\fR string capability. If the terminal can backspace, then it should have the \fBbs\fR capability, unless a backspace is accomplished by a character other than \fB^H\fR (ugh) in which case you should give this character as the \fBbc\fR string capability. If it overstrikes (rather than clearing a position when a character is struck over) then it should have the \fBos\fR capability. .PP A very important point here is that the local cursor motions encoded in .I termcap are undefined at the left and top edges of a \s-2CRT\s0 terminal. The editor will never attempt to backspace around the left edge, nor will it attempt to go up locally off the top. The editor assumes that feeding off the bottom of the screen will cause the screen to scroll up, and the \fBam\fR capability tells whether the cursor sticks at the right edge of the screen. If the terminal has switch selectable automatic margins, the .I termcap file always assumes that this is on, i.e. \fBam\fR. .PP These capabilities suffice to describe hardcopy and ``glass-tty'' terminals. Thus the model 33 teletype is described as .PP .DT t3|33|tty33:co#72:os .PP while the Lear Siegler \s-2ADM\-3\s0 is described as .PP .DT cl|adm3|3|lsi adm3:am:bs:cl=^Z:li#24:co#80 .PP .B Cursor addressing .PP Cursor addressing in the terminal is described by a \fBcm\fR string capability, with .IR printf (3s) like escapes \fB%x\fR in it. These substitute to encodings of the current line or column position, while other characters are passed through unchanged. If the \fBcm\fR string is thought of as being a function, then its arguments are the line and then the column to which motion is desired, and the \fB%\fR encodings have the following meanings: .PP .DT .nf %d as in \fIprintf\fR, 0 origin %2 like %2d %3 like %3d %. like %c %+x adds \fIx\fR to value, then %. %