1TERMCAP(5)                    File Formats Manual                   TERMCAP(5)
2
3
4

NAME

6       termcap - terminal capability data base
7

SYNOPSIS

9       /etc/termcap
10

DESCRIPTION

12       Termcap  is  a data base describing terminals, used, e.g., by vi(1) and
13       curses(3X).  Terminals are described in termcap  by  giving  a  set  of
14       capabilities  that  they have and by describing how operations are per‐
15       formed.  Padding requirements and initialization sequences are included
16       in termcap.
17
18       Entries  in  termcap  consist of a number of `:'-separated fields.  The
19       first entry for each terminal gives the names that are  known  for  the
20       terminal,  separated  by  `|' characters.  The first name is always two
21       characters long and is used by older systems which store  the  terminal
22       type  in  a  16-bit  word  in a system-wide data base.  The second name
23       given is the most common abbreviation for the terminal, the  last  name
24       given  should  be  a  long name fully identifying the terminal, and all
25       others are understood as synonyms for the terminal name.  All names but
26       the  first  and last should be in lower case and contain no blanks; the
27       last name may well contain upper case and blanks for readability.
28
29       Terminal names (except for the last, verbose entry)  should  be  chosen
30       using the following conventions.  The particular piece of hardware mak‐
31       ing up the terminal should have a  root  name  chosen,  thus  “hp2621”.
32       This  name  should not contain hyphens.  Modes that the hardware can be
33       in or user preferences should be indicated by appending a hyphen and an
34       indicator  of  the mode.  Therefore, a “vt100” in 132-column mode would
35       be “vt100-w”.  The following suffixes should be used where possible:
36
37       Suffix   Meaning                                   Example
38       -w       Wide mode (more than 80 columns)          vt100-w
39       -am      With automatic margins (usually default)  vt100-am
40       -nam     Without automatic margins                 vt100-nam
41       -n       Number of lines on the screen             aaa-60
42       -na      No arrow keys (leave them in local)       concept100-na
43       -np      Number of pages of memory                 concept100-4p
44       -rv      Reverse video                             concept100-rv
45

CAPABILITIES

47       The characters in the Notes field in the table have the following mean‐
48       ings (more than one may apply to a capability):
49
50       N   indicates numeric parameter(s)
51       P   indicates that padding may be specified
52       ∗   indicates that padding may be based on the number of lines affected
53       o   indicates capability is obsolete
54
55       “Obsolete”  capabilities  have no terminfo equivalents, since they were
56       considered useless, or are subsumed by other capabilities.   New  soft‐
57       ware should not rely on them at all.
58
59       Name  Type  Notes  Description
60       ae    str   (P)    End alternate character set
61       AL    str   (NP∗)  Add n new blank lines
62       al    str   (P∗)   Add new blank line
63       am    bool         Terminal has automatic margins
64       as    str   (P)    Start alternate character set
65       bc    str   (o)    Backspace if not ^H
66       bl    str   (P)    Audible signal (bell)
67       bs    bool  (o)    Terminal can backspace with ^H
68       bt    str   (P)    Back tab
69       bw    bool         le (backspace) wraps from column 0 to last column
70       CC    str          Terminal settable command character in prototype
71       cd    str   (P∗)   Clear to end of display
72       ce    str   (P)    Clear to end of line
73       ch    str   (NP)   Set cursor column (horizontal position)
74       cl    str   (P∗)   Clear screen and home cursor
75       CM    str   (NP)   Memory-relative cursor addressing
76       cm    str   (NP)   Screen-relative cursor motion
77       co    num          Number of columns in a line (See BUGS section below)
78       cr    str   (P)    Carriage return
79       cs    str   (NP)   Change scrolling region (VT100)
80       ct    str   (P)    Clear all tab stops
81       cv    str   (NP)   Set cursor row (vertical position)
82       da    bool         Display may be retained above the screen
83       dB    num   (o)    Milliseconds of bs delay needed (default 0)
84       db    bool         Display may be retained below the screen
85       DC    str   (NP∗)  Delete n characters
86       dC    num   (o)    Milliseconds of cr delay needed (default 0)
87       dc    str   (P∗)   Delete character
88       dF    num   (o)    Milliseconds of ff delay needed (default 0)
89       DL    str   (NP∗)  Delete n lines
90       dl    str   (P∗)   Delete line
91       dm    str          Enter delete mode
92       dN    num   (o)    Milliseconds of nl delay needed (default 0)
93       DO    str   (NP∗)  Move cursor down n lines
94       do    str          Down one line
95       ds    str          Disable status line
96       dT    num   (o)    Milliseconds of horizontal tab delay needed (default 0)
97       dV    num   (o)    Milliseconds of vertical tab delay needed (default 0)
98       ec    str   (NP)   Erase n characters
99       ed    str          End delete mode
100       ei    str          End insert mode
101       eo    bool         Can erase overstrikes with a blank
102       EP    bool  (o)    Even parity
103       es    bool         Escape can be used on the status line
104       ff    str   (P∗)   Hardcopy terminal page eject
105       fs    str          Return from status line
106       gn    bool         Generic line type (e.g. dialup, switch)
107       hc    bool         Hardcopy terminal
108       HD    bool  (o)    Half-duplex
109       hd    str          Half-line down (forward 1/2 linefeed)
110       ho    str   (P)    Home cursor
111       hs    bool         Has extra “status line”
112       hu    str          Half-line up (reverse 1/2 linefeed)
113       hz    bool         Cannot print ~s (Hazeltine)
114       i1-i3 str          Terminal initialization strings (terminfo only)
115       IC    str   (NP∗)  Insert n blank characters
116       ic    str   (P∗)   Insert character
117       if    str          Name of file containing initialization string
118       im    str          Enter insert mode
119       in    bool         Insert mode distinguishes nulls
120       iP    str          Pathname of program for initialization (terminfo only)
121       ip    str   (P∗)   Insert pad after character inserted
122       is    str          Terminal initialization string (termcap only)
123       it    num          Tabs initially every n positions
124       K1    str          Sent by keypad upper left
125       K2    str          Sent by keypad upper right
126       K3    str          Sent by keypad center
127       K4    str          Sent by keypad lower left
128       K5    str          Sent by keypad lower right
129       k0-k9 str          Sent by function keys 0-9
130       kA    str          Sent by insert-line key
131       ka    str          Sent by clear-all-tabs key
132       kb    str          Sent by backspace key
133       kC    str          Sent by clear-screen or erase key
134       kD    str          Sent by delete-character key
135       kd    str          Sent by down-arrow key
136       kE    str          Sent by clear-to-end-of-line key
137       ke    str          Out of “keypad transmit” mode
138       kF    str          Sent by scroll-forward/down key
139       kH    str          Sent by home-down key
140       kh    str          Sent by home key
141       kI    str          Sent by insert-character or enter-insert-mode key
142       kL    str          Sent by delete-line key
143       kl    str          Sent by left-arrow key
144       kM    str          Sent by insert key while in insert mode
145       km    bool         Has a “meta” key (shift, sets parity bit)
146       kN    str          Sent by next-page key
147       kn    num   (o)    Number of function (k0-k9) keys (default 0)
148       ko    str   (o)    Termcap entries for other non-function keys
149       kP    str          Sent by previous-page key
150       kR    str          Sent by scroll-backward/up key
151       kr    str          Sent by right-arrow key
152       kS    str          Sent by clear-to-end-of-screen key
153       ks    str          Put terminal in “keypad transmit” mode
154       kT    str          Sent by set-tab key
155       kt    str          Sent by clear-tab key
156       ku    str          Sent by up-arrow key
157       l0-l9 str          Labels on function keys if not “fn
158       LC    bool  (o)    Lower-case only
159       LE    str   (NP)   Move cursor left n positions
160       le    str   (P)    Move cursor left one position
161       li    num          Number of lines on screen or page (See BUGS section below)
162       ll    str          Last line, first column
163       lm    num          Lines of memory if > li (0 means varies)
164       ma    str   (o)    Arrow key map (used by vi version 2 only)
165       mb    str          Turn on blinking attribute
166       md    str          Turn on bold (extra bright) attribute
167       me    str          Turn off all attributes
168       mh    str          Turn on half-bright attribute
169       mi    bool         Safe to move while in insert mode
170       mk    str          Turn on blank attribute (characters invisible)
171       ml    str   (o)    Memory lock on above cursor
172       mm    str          Turn on “meta mode” (8th bit)
173       mo    str          Turn off “meta mode”
174       mp    str          Turn on protected attribute
175       mr    str          Turn on reverse-video attibute
176       ms    bool         Safe to move in standout modes
177       mu    str   (o)    Memory unlock (turn off memory lock)
178       nc    bool  (o)    No correctly-working cr (Datamedia 2500, Hazeltine 2000)
179       nd    str          Non-destructive space (cursor right)
180       NL    bool  (o)    \n is newline, not line feed
181       nl    str   (o)    Newline character if not \n
182       ns    bool  (o)    Terminal is a CRT but doesn't scroll
183       nw    str   (P)    Newline (behaves like cr followed by do)
184       OP    bool  (o)    Odd parity
185       os    bool         Terminal overstrikes
186       pb    num          Lowest baud where delays are required
187       pc    str          Pad character (default NUL)
188       pf    str          Turn off the printer
189       pk    str          Program function key n to type string s (terminfo only)
190       pl    str          Program function key n to execute string s (terminfo only)
191       pO    str   (N)    Turn on the printer for n bytes
192       po    str          Turn on the printer
193       ps    str          Print contents of the screen
194       pt    bool  (o)    Has hardware tabs (may need to be set with is)
195       px    str          Program function key n to transmit string s (terminfo only)
196       r1-r3 str          Reset terminal completely to sane modes (terminfo only)
197       rc    str   (P)    Restore cursor to position of last sc
198       rf    str          Name of file containing reset codes
199       RI    str   (NP)   Move cursor right n positions
200       rp    str   (NP∗)  Repeat character c n times
201       rs    str          Reset terminal completely to sane modes (termcap only)
202       sa    str   (NP)   Define the video attributes
203       sc    str   (P)    Save cursor position
204       se    str          End standout mode
205       SF    str   (NP∗)  Scroll forward n lines
206       sf    str   (P)    Scroll text up
207       sg    num          Number of garbage chars left by so or se (default 0)
208       so    str          Begin standout mode
209       SR    str   (NP∗)  Scroll backward n lines
210       sr    str   (P)    Scroll text down
211       st    str          Set a tab in all rows, current column
212       ta    str   (P)    Tab to next 8-position hardware tab stop
213       tc    str          Entry of similar terminal - must be last
214       te    str          String to end programs that use termcap
215       ti    str          String to begin programs that use termcap
216       ts    str   (N)    Go to status line, column n
217       UC    bool  (o)    Upper-case only
218       uc    str          Underscore one character and move past it
219       ue    str          End underscore mode
220       ug    num          Number of garbage chars left by us or ue (default 0)
221       ul    bool         Underline character overstrikes
222       UP    str   (NP∗)  Move cursor up n lines
223       up    str          Upline (cursor up)
224       us    str          Start underscore mode
225       vb    str          Visible bell (must not move cursor)
226       ve    str          Make cursor appear normal (undo vs/vi)
227       vi    str          Make cursor invisible
228       vs    str          Make cursor very visible
229       vt    num          Virtual terminal number (not supported on all systems)
230       wi    str   (N)    Set current window
231       ws    num          Number of columns in status line
232       xb    bool         Beehive (f1=ESC, f2=^C)
233       xn    bool         Newline ignored after 80 cols (Concept)
234       xo    bool         Terminal uses xoff/xon (DC3/DC1) handshaking
235       xr    bool  (o)    Return acts like ce cr nl (Delta Data)
236       xs    bool         Standout not erased by overwriting (Hewlett-Packard)
237       xt    bool         Tabs ruin, magic so char (Teleray 1061)
238       xx    bool  (o)    Tektronix 4025 insert-line
239
240       A Sample Entry
241
242       The following entry, which describes the Concept-100, is among the more
243       complex entries in the termcap file as of this writing.
244
245       ca|concept100|c100|concept|c104|concept100-4p|HDS Concept-100:\
246               :al=3∗\E^R:am:bl=^G:cd=16∗\E^C:ce=16\E^U:cl=2∗^L:cm=\Ea%+ %+ :\
247               :co#80:.cr=9^M:db:dc=16\E^A:dl=3∗\E^B:do=^J:ei=\E\200:eo:im=\E^P:in:\
248               :ip=16∗:is=\EU\Ef\E7\E5\E8\El\ENH\EK\E\200\Eo&\200\Eo\47\E:k1=\E5:\
249               :k2=\E6:k3=\E7:kb=^h:kd=\E<:ke=\Ex:kh=\E?:kl=\E>:kr=\E=:ks=\EX:\
250               :ku=\E;:le=^H:li#24:mb=\EC:me=\EN\200:mh=\EE:mi:mk=\EH:mp=\EI:\
251               :mr=\ED:nd=\E=:pb#9600:rp=0.2∗\Er%.%+ :se=\Ed\Ee:sf=^J:so=\EE\ED:\
252               :.ta=8\t:te=\Ev    \200\200\200\200\200\200\Ep\r\n:\
253               :ti=\EU\Ev  8p\Ep\r:ue=\Eg:ul:up=\E;:us=\EG:\
254               :vb=\Ek\200\200\200\200\200\200\200\200\200\200\200\200\200\200\EK:\
255               :ve=\Ew:vs=\EW:vt#8:xn:\
256               :bs:cr=^M:dC#9:dT#8:nl=^J:ta=^I:pt:
257
258       Entries may continue onto multiple lines by giving  a  \  as  the  last
259       character  of  a line, and empty fields may be included for readability
260       (here between the last field on a line  and  the  first  field  on  the
261       next).  Comments may be included on lines beginning with “#”.
262
263       Types of Capabilities
264
265       Capabilities in termcap are of three types: Boolean capabilities, which
266       indicate particular features that the terminal has;  numeric  capabili‐
267       ties,  giving  the size of the display or the size of other attributes;
268       and string capabilities, which give character  sequences  that  can  be
269       used  to perform particular terminal operations.  All capabilities have
270       two-letter codes.  For instance, the fact that the  Concept  has  auto‐
271       matic margins (i.e., an automatic return and linefeed when the end of a
272       line is reached) is indicated by the Boolean capability am.  Hence  the
273       description of the Concept includes am.
274
275       Numeric  capabilities are followed by the character `#' then the value.
276       In the example above co, which indicates the number of columns the dis‐
277       play has, gives the value `80' for the Concept.
278
279       Finally,  string-valued  capabilities, such as ce (clear-to-end-of-line
280       sequence) are given by the two-letter code, an `=', then a string  end‐
281       ing  at  the  next  following  `:'.  A delay in milliseconds may appear
282       after the `=' in such a capability, which causes padding characters  to
283       be  supplied by tputs after the remainder of the string is sent to pro‐
284       vide this delay.  The delay can be either a number, e.g.   `20',  or  a
285       number  followed by an `∗', i.e., `3∗'.  An `∗' indicates that the pad‐
286       ding required is proportional to the number of lines  affected  by  the
287       operation,  and  the  amount  given  is  the  per-affected-line padding
288       required.  (In the case of insert-character, the factor  is  still  the
289       number  of  lines affected; this is always 1 unless the terminal has in
290       and the software uses it.)  When an `∗' is specified, it  is  sometimes
291       useful to give a delay of the form `3.5' to specify a delay per line to
292       tenths of milliseconds.  (Only one decimal place is allowed.)
293
294       A number of escape sequences are provided in the string-valued capabil‐
295       ities for easy encoding of control characters there.  \E maps to an ESC
296       character, ^X maps to a  control-X  for  any  appropriate  X,  and  the
297       sequences  \n  \r \t \b \f map to linefeed, return, tab, backspace, and
298       formfeed, respectively.  Finally, characters  may  be  given  as  three
299       octal  digits  after a \, and the characters ^ and \ may be given as \^
300       and \\.  If it is necessary to place a : in a  capability  it  must  be
301       escaped  in octal as \072.  If it is necessary to place a NUL character
302       in a string capability it must be encoded as \200.  (The routines  that
303       deal  with  termcap use C strings and strip the high bits of the output
304       very late, so that a \200 comes out as a \000 would.)
305
306       Sometimes individual capabilities must be commented out.  To  do  this,
307       put a period before the capability name.  For example, see the first cr
308       and ta in the example above.
309
310       Preparing Descriptions
311
312       We now outline how to prepare  descriptions  of  terminals.   The  most
313       effective  way  to  prepare  a terminal description is by imitating the
314       description of a similar terminal in termcap and to build up a descrip‐
315       tion  gradually,  using partial descriptions with vi to check that they
316       are correct.  Be aware that a very unusual terminal  may  expose  defi‐
317       ciencies  in  the ability of the termcap file to describe it or bugs in
318       vi.  To easily test a new terminal description you can set the environ‐
319       ment variable TERMCAP to the absolute pathname of a file containing the
320       description you are working on and programs will look there rather than
321       in  /etc/termcap.   TERMCAP can also be set to the termcap entry itself
322       to avoid reading the file when starting up a program.
323
324       To get the padding for insert-line right (if the terminal  manufacturer
325       did not document it), a severe test is to use vi to edit /etc/passwd at
326       9600 baud, delete roughly 16 lines from the middle of the screen,  then
327       hit  the `u' key several times quickly.  If the display messes up, more
328       padding is usually needed.  A similar test can be used for insert-char‐
329       acter.
330
331       Basic Capabilities
332
333       The  number  of  columns on each line of the display is given by the co
334       numeric capability.  If the display is a CRT, then the number of  lines
335       on  the  screen  is  given  by the li capability.  If the display wraps
336       around to the beginning of the next line when the  cursor  reaches  the
337       right  margin,  then it should have the am capability.  If the terminal
338       can clear its screen, the code to do this is given  by  the  cl  string
339       capability.   If  the  terminal  overstrikes  (rather than clearing the
340       position when a character is overwritten), it should have the os  capa‐
341       bility.   If  the  terminal  is  a printing terminal, with no soft copy
342       unit, give it both hc and os.  (os applies to storage scope  terminals,
343       such as the Tektronix 4010 series, as well as to hard copy and APL ter‐
344       minals.)  If there is a code to move the cursor to the left edge of the
345       current  row, give this as cr.  (Normally this will be carriage-return,
346       ^M.)  If there is a code to produce  an  audible  signal  (bell,  beep,
347       etc.), give this as bl.
348
349       If  there is a code (such as backspace) to move the cursor one position
350       to the left, that capability should be given as le.   Similarly,  codes
351       to  move  to the right, up, and down should be given as nd, up, and do,
352       respectively.  These local cursor motions should  not  alter  the  text
353       they  pass  over; for example, you would not normally use “nd= ” unless
354       the terminal has the os capability, because the space would  erase  the
355       character moved over.
356
357       A very important point here is that the local cursor motions encoded in
358       termcap have undefined behavior at the left and top edges of a CRT dis‐
359       play.  Programs should never attempt to backspace around the left edge,
360       unless bw is given, and never attempt to go up off the top using  local
361       cursor motions.
362
363       In order to scroll text up, a program goes to the bottom left corner of
364       the screen and sends the sf (index) string.  To  scroll  text  down,  a
365       program  goes  to  the  top  left corner of the screen and sends the sr
366       (reverse index) string.  The strings sf and sr have undefined  behavior
367       when not on their respective corners of the screen.  Parameterized ver‐
368       sions of the scrolling sequences are SF and SR,  which  have  the  same
369       semantics  as  sf and sr except that they take one parameter and scroll
370       that many lines.  They also  have  undefined  behavior  except  at  the
371       appropriate corner of the screen.
372
373       The  am capability tells whether the cursor sticks at the right edge of
374       the screen when text is output there, but  this  does  not  necessarily
375       apply  to  nd  from  the last column.  Leftward local motion is defined
376       from the left edge only when bw is given; then an le from the left edge
377       will  move  to  the right edge of the previous row.  This is useful for
378       drawing a box around the edge of the screen, for example.  If the  ter‐
379       minal  has switch-selectable automatic margins, the termcap description
380       usually assumes that this feature is on, i.e., am.  If the terminal has
381       a command that moves to the first column of the next line, that command
382       can be given as nw (newline).  It is permissible for this to clear  the
383       remainder  of  the  current  line, so if the terminal has no correctly-
384       working CR and LF it may still be possible to craft a working nw out of
385       one or both of them.
386
387       These  capabilities suffice to describe hardcopy and “glass-tty” termi‐
388       nals.  Thus the Teletype model 33 is described as
389
390               T3|tty33|33|tty|Teletype model 33:\
391                       :bl=^G:co#72:cr=^M:do=^J:hc:os:
392
393       and the Lear Siegler ADM-3 is described as
394
395               l3|adm3|3|LSI ADM-3:\
396                       :am:bl=^G:cl=^Z:co#80:cr=^M:do=^J:le=^H:li#24:sf=^J:
397
398       Parameterized Strings
399
400       Cursor addressing and other strings requiring parameters are  described
401       by  a  parameterized string capability, with printf(3S)-like escapes %x
402       in it, while other characters are passed through unchanged.  For  exam‐
403       ple, to address the cursor the cm capability is given, using two param‐
404       eters: the row and column to move to.  (Rows and columns  are  numbered
405       from  zero and refer to the physical screen visible to the user, not to
406       any unseen memory.  If the terminal has memory-relative cursor address‐
407       ing, that can be indicated by an analogous CM capability.)
408
409       The % encodings have the following meanings:
410
411            %%   output `%'
412            %d   output value as in printf %d
413            %2   output value as in printf %2d
414            %3   output value as in printf %3d
415            %.   output value as in printf %c
416            %+x  add x to value, then do %.
417            %>xy if value > x then add y, no output
418            %r   reverse order of two parameters, no output
419            %i   increment by one, no output
420            %n   exclusive-or all parameters with 0140 (Datamedia 2500)
421            %B   BCD (16∗(value/10)) + (value%10), no output
422            %D   Reverse coding (value - 2∗(value%16)), no output (Delta Data)
423
424       Consider  the  Hewlett-Packard  2645, which, to get to row 3 and column
425       12, needs to be sent “\E&a12c03Y” padded for 6 milliseconds.  Note that
426       the  order  of the row and column coordinates is reversed here and that
427       the row and column are sent as two-digit integers.  Thus its  cm  capa‐
428       bility is “cm=6\E&%r%2c%2Y”.
429
430       The  Microterm  ACT-IV  needs  the  current  row and column sent simply
431       encoded in binary preceded by a ^T, “cm=^T%.%.”.   Terminals  that  use
432       “%.”  need to be able to backspace the cursor (le) and to move the cur‐
433       sor up one line on the screen (up).  This is necessary  because  it  is
434       not always safe to transmit \n, ^D, and \r, as the system may change or
435       discard them.  (Programs using termcap must set terminal modes so  that
436       tabs  are  not  expanded,  so \t is safe to send.  This turns out to be
437       essential for the Ann Arbor 4080.)
438
439       A final example is the Lear Siegler ADM-3a, which offsets row and  col‐
440       umn by a blank character, thus “cm=\E=%+ %+ ”.
441
442       Row or column absolute cursor addressing can be given as single parame‐
443       ter capabilities ch (horizontal position  absolute)  and  cv  (vertical
444       position  absolute).  Sometimes these are shorter than the more general
445       two-parameter sequence (as with the Hewlett-Packard 2645)  and  can  be
446       used  in  preference  to  cm.  If there are parameterized local motions
447       (e.g., move n positions to the right) these can be given as DO, LE, RI,
448       and  UP  with a single parameter indicating how many positions to move.
449       These are primarily useful if the terminal does not have  cm,  such  as
450       the Tektronix 4025.
451
452       Cursor Motions
453
454       If  the  terminal  has a fast way to home the cursor (to the very upper
455       left corner of the screen), this can be given as ho.  Similarly, a fast
456       way  of  getting to the lower left-hand corner can be given as ll; this
457       may involve going up with up from the  home  position,  but  a  program
458       should  never  do  this itself (unless ll does), because it can make no
459       assumption about the effect of moving up from the home position.   Note
460       that  the home position is the same as cursor address (0,0): to the top
461       left corner of the  screen,  not  of  memory.   (Therefore,  the  “\EH”
462       sequence on Hewlett-Packard terminals cannot be used for ho.)
463
464       Area Clears
465
466       If  the  terminal can clear from the current position to the end of the
467       line, leaving the cursor where it is, this should be given as  ce.   If
468       the terminal can clear from the current position to the end of the dis‐
469       play, this should be given as cd.  cd must only  be  invoked  from  the
470       first  column  of a line.  (Therefore, it can be simulated by a request
471       to delete a large number of lines, if a true cd is not available.)
472
473       Insert/Delete Line
474
475       If the terminal can open a new blank line before  the  line  containing
476       the  cursor, this should be given as al; this must be invoked only from
477       the first position of a line.  The cursor must then appear at the  left
478       of  the newly blank line.  If the terminal can delete the line that the
479       cursor is on, this should be given as dl; this must only be  used  from
480       the  first  position  on the line to be deleted.  Versions of al and dl
481       which take a single parameter and insert or delete that many lines  can
482       be given as AL and DL.  If the terminal has a settable scrolling region
483       (like the VT100), the command to set this can be described with the  cs
484       capability, which takes two parameters: the top and bottom lines of the
485       scrolling region.  The cursor position is, alas, undefined after  using
486       this  command.   It  is  possible to get the effect of insert or delete
487       line using this command — the sc and rc (save and restore cursor)  com‐
488       mands  are  also  useful.   Inserting lines at the top or bottom of the
489       screen can also be done using sr or sf on many terminals without a true
490       insert/delete  line,  and  is often faster even on terminals with those
491       features.
492
493       If the terminal has the ability to define a window as  part  of  memory
494       which  all  commands  affect,  it  should be given as the parameterized
495       string wi.  The four parameters are the starting and  ending  lines  in
496       memory  and  the  starting and ending columns in memory, in that order.
497       (This  terminfo  capability  is  described  for  completeness.   It  is
498       unlikely that any termcap-using program will support it.)
499
500       If the terminal can retain display memory above the screen, then the da
501       capability should be given; if display memory can  be  retained  below,
502       then  db  should  be  given.   These  indicate  that deleting a line or
503       scrolling may bring non-blank lines up from  below  or  that  scrolling
504       back with sr may bring down non-blank lines.
505
506       Insert/Delete Character
507
508       There  are  two  basic  kinds  of intelligent terminals with respect to
509       insert/delete character that can be described using termcap.  The  most
510       common insert/delete character operations affect only the characters on
511       the current line and shift characters off the end of the line  rigidly.
512       Other terminals, such as the Concept-100 and the Perkin Elmer Owl, make
513       a distinction between typed and untyped blanks on the screen,  shifting
514       upon  an  insert or delete only to an untyped blank on the screen which
515       is either eliminated or expanded to two untyped blanks.  You can deter‐
516       mine  the  kind of terminal you have by clearing the screen then typing
517       text separated by cursor motions.  Type “abc    def” using local cursor
518       motions  (not  spaces)  between the “abc” and the “def”.  Then position
519       the cursor before the “abc” and put the terminal in  insert  mode.   If
520       typing  characters  causes  the  rest  of the line to shift rigidly and
521       characters to fall off the end, then your terminal does not distinguish
522       between  blanks and untyped positions.  If the “abc” shifts over to the
523       “def” which then move together around the end of the current  line  and
524       onto  the next as you insert, then you have the second type of terminal
525       and should give the capability in,  which  stands  for  “insert  null”.
526       While these are two logically separate attributes (one line vs.  multi-
527       line insert mode, and special treatment of  untyped  spaces),  we  have
528       seen no terminals whose insert mode cannot be described with the single
529       attribute.
530
531       Termcap can describe both terminals that have an insert mode and termi‐
532       nals  that  send a simple sequence to open a blank position on the cur‐
533       rent line.  Give as im the sequence to get into insert mode.   Give  as
534       ei the sequence to leave insert mode.  Now give as ic any sequence that
535       needs to be sent just before each character to be inserted.  Most  ter‐
536       minals  with  a true insert mode will not give ic; terminals that use a
537       sequence to open a screen position should give it here.  (If your  ter‐
538       minal  has  both, insert mode is usually preferable to ic.  Do not give
539       both unless the terminal actually requires both to be used in  combina‐
540       tion.)  If post-insert padding is needed, give this as a number of mil‐
541       liseconds in ip (a string option).  Any other sequence that may need to
542       be  sent after insertion of a single character can also be given in ip.
543       If your terminal needs to be placed into an `insert mode' and  needs  a
544       special  code preceding each inserted character, then both im/ei and ic
545       can be given, and both will be  used.   The  IC  capability,  with  one
546       parameter n, will repeat the effects of ic n times.
547
548       It  is  occasionally  necessary  to move around while in insert mode to
549       delete characters on the same line (e.g., if there is a tab  after  the
550       insertion  position).   If  your terminal allows motion while in insert
551       mode, you can give the capability mi to  speed  up  inserting  in  this
552       case.   Omitting  mi  will  affect only speed.  Some terminals (notably
553       Datamedia's) must not have mi because of  the  way  their  insert  mode
554       works.
555
556       Finally,  you  can specify dc to delete a single character, DC with one
557       parameter n to delete n characters, and delete mode by giving dm and ed
558       to  enter and exit delete mode (which is any mode the terminal needs to
559       be placed in for dc to work).
560
561       Highlighting, Underlining, and Visible Bells
562
563       If your terminal has one or more kinds of display attributes, these can
564       be  represented  in  a number of different ways.  You should choose one
565       display form as standout mode, representing a good high-contrast, easy-
566       on-the-eyes  format for highlighting error messages and other attention
567       getters.  (If you have a choice,  reverse  video  plus  half-bright  is
568       good,  or reverse video alone.)  The sequences to enter and exit stand‐
569       out mode are given as so and se, respectively.  If the code  to  change
570       into  or  out  of  standout mode leaves one or even two blank spaces or
571       garbage characters on the screen, as the TVI 912 and Teleray  1061  do,
572       then sg should be given to tell how many characters are left.
573
574       Codes  to  begin underlining and end underlining can be given as us and
575       ue, respectively.  Underline mode change garbage is  specified  by  ug,
576       similar  to  sg.   If  the terminal has a code to underline the current
577       character and move the cursor one position to the right,  such  as  the
578       Microterm Mime, this can be given as uc.
579
580       Other  capabilities  to  enter  various  highlighting  modes include mb
581       (blinking), md (bold or extra bright),  mh  (dim  or  half-bright),  mk
582       (blanking  or  invisible  text), mp (protected), mr (reverse video), me
583       (turn off all attribute  modes),  as  (enter  alternate  character  set
584       mode),  and  ae (exit alternate character set mode).  Turning on any of
585       these modes singly may or may not turn off other modes.
586
587       If there is a sequence to set  arbitrary  combinations  of  mode,  this
588       should  be  given  as  sa  (set attributes), taking 9 parameters.  Each
589       parameter is either 0 or 1, as the corresponding attributes  is  on  or
590       off.   The  9  parameters  are, in order: standout, underline, reverse,
591       blink, dim, bold, blank, protect, and alternate character set.  Not all
592       modes  need  be  supported  by  sa,  only those for which corresponding
593       attribute commands exist.  (It is unlikely that a termcap-using program
594       will  support  this capability, which is defined for compatibility with
595       terminfo.)
596
597       Terminals with the “magic cookie” glitches (sg  and  ug),  rather  than
598       maintaining  extra  attribute  bits  for  each  character cell, instead
599       deposit special “cookies”, or “garbage characters”, when  they  receive
600       mode-setting sequences, which affect the display algorithm.
601
602       Some  terminals,  such as the Hewlett-Packard 2621, automatically leave
603       standout mode when they move to a  new  line  or  when  the  cursor  is
604       addressed.   Programs  using standout mode should exit standout mode on
605       such terminals before moving the cursor or sending a newline.  On  ter‐
606       minals where this is not a problem, the ms capability should be present
607       to say that this overhead is unnecessary.
608
609       If the terminal has a way of flashing the screen to indicate  an  error
610       quietly (a bell replacement), this can be given as vb; it must not move
611       the cursor.
612
613       If the cursor needs to be made more visible than normal when it is  not
614       on  the  bottom  line (to change, for example, a non-blinking underline
615       into an easier-to-find block or blinking underline), give this sequence
616       as vs.  If there is a way to make the cursor completely invisible, give
617       that as vi.  The capability ve, which undoes the  effects  of  both  of
618       these modes, should also be given.
619
620       If your terminal correctly displays underlined characters (with no spe‐
621       cial codes needed) even though it does not overstrike, then you  should
622       give the capability ul.  If overstrikes are erasable with a blank, this
623       should be indicated by giving eo.
624
625       Keypad
626
627       If the terminal has a keypad that transmits codes  when  the  keys  are
628       pressed,  this  information can be given.  Note that it is not possible
629       to handle terminals where the keypad only works  in  local  mode  (this
630       applies,  for example, to the unshifted Hewlett-Packard 2621 keys).  If
631       the keypad can be set to transmit or not transmit, give these codes  as
632       ks  and  ke.   Otherwise the keypad is assumed to always transmit.  The
633       codes sent by the left-arrow, right-arrow,  up-arrow,  down-arrow,  and
634       home  keys  can  be  given as kl, kr, ku, kd, and kh, respectively.  If
635       there are function keys such as f0, f1, ..., f9, the  codes  they  send
636       can  be  given as k0, k1,..., k9.  If these keys have labels other than
637       the default f0 through f9, the labels can be given as l0,  l1,...,  l9.
638       The  codes  transmitted  by certain other special keys can be given: kH
639       (home down), kb (backspace), ka (clear all tabs),  kt  (clear  the  tab
640       stop  in  this  column), kC (clear screen or erase), kD (delete charac‐
641       ter), kL (delete line), kM (exit insert mode),  kE  (clear  to  end  of
642       line),  kS  (clear  to  end  of  screen), kI (insert character or enter
643       insert mode), kA (insert line), kN (next page), kP (previous page),  kF
644       (scroll  forward/down), kR (scroll backward/up), and kT (set a tab stop
645       in this column).  In addition, if the keypad has a 3 by 3 array of keys
646       including the four arrow keys, then the other five keys can be given as
647       K1, K2, K3, K4, and K5.  These keys are useful when the effects of a  3
648       by  3  directional pad are needed.  The obsolete ko capability formerly
649       used to describe “other” function keys has been  completely  supplanted
650       by the above capabilities.
651
652       The ma entry is also used to indicate arrow keys on terminals that have
653       single-character arrow keys.  It is obsolete but still in use  in  ver‐
654       sion 2 of vi which must be run on some minicomputers due to memory lim‐
655       itations.  This field is redundant with kl, kr, ku,  kd,  and  kh.   It
656       consists of groups of two characters.  In each group, the first charac‐
657       ter is what an arrow key sends, and the second character is the  corre‐
658       sponding  vi command.  These commands are h for kl, j for kd, k for ku,
659       l  for  kr,  and  H  for  kh.   For  example,  the  Mime   would   have
660       “ma=^Hh^Kj^Zk^Xl”  indicating arrow keys left (^H), down (^K), up (^Z),
661       and right (^X).  (There is no home key on the Mime.)
662
663       Tabs and Initialization
664
665       If the terminal needs to be in a special mode when  running  a  program
666       that uses these capabilities, the codes to enter and exit this mode can
667       be given as ti and te.  This arises, for example, from  terminals  like
668       the  Concept  with  more  than one page of memory.  If the terminal has
669       only memory-relative cursor addressing and not  screen-relative  cursor
670       addressing,  a  screen-sized  window must be fixed into the display for
671       cursor addressing to work properly.  This is also  used  for  the  Tek‐
672       tronix  4025, where ti sets the command character to be the one used by
673       termcap.
674
675       Other capabilities include is, an initialization string for the  termi‐
676       nal, and if, the name of a file containing long initialization strings.
677       These strings are expected to set the terminal  into  modes  consistent
678       with  the  rest  of the termcap description.  They are normally sent to
679       the terminal by the tset program each time the user logs in.  They will
680       be  printed  in  the following order: is; setting tabs using ct and st;
681       and finally if.  (Terminfo uses i1-i2 instead of is and runs  the  pro‐
682       gram  iP  and  prints  i3  after the other initializations.)  A pair of
683       sequences that does a harder reset from a totally unknown state can  be
684       analogously  given as rs and if.  These strings are output by the reset
685       program, which is used when the terminal  gets  into  a  wedged  state.
686       (Terminfo  uses  r1-r3 instead of rs.)  Commands are normally placed in
687       rs and rf only if they produce annoying effects on the screen  and  are
688       not  necessary  when  logging  in.  For example, the command to set the
689       VT100 into 80-column mode would normally be part of is, but  it  causes
690       an  annoying  glitch of the screen and is not normally needed since the
691       terminal is usually already in 80-column mode.
692
693       If the terminal has hardware tabs, the command to advance to  the  next
694       tab  stop  can  be given as ta (usually ^I).  A “backtab” command which
695       moves leftward to the previous tab stop can be given as bt.  By conven‐
696       tion,  if  the  terminal driver modes indicate that tab stops are being
697       expanded by the computer rather than being sent to the  terminal,  pro‐
698       grams  should not use ta or bt even if they are present, since the user
699       may not have the tab stops properly set.  If the terminal has  hardware
700       tabs that are initially set every n positions when the terminal is pow‐
701       ered up, then the numeric parameter it is given, showing the number  of
702       positions between tab stops.  This is normally used by the tset command
703       to determine whether to set the driver mode for hardware tab expansion,
704       and  whether  to set the tab stops.  If the terminal has tab stops that
705       can be saved in nonvolatile memory, the termcap description can  assume
706       that they are properly set.
707
708       If  there are commands to set and clear tab stops, they can be given as
709       ct (clear all tab stops) and st (set a tab stop in the  current  column
710       of  every  row).   If a more complex sequence is needed to set the tabs
711       than can be described by this, the sequence can be placed in is or if.
712
713       Delays
714
715       Certain capabilities control padding in the terminal driver.  These are
716       primarily needed by hardcopy terminals and are used by the tset program
717       to set terminal driver modes appropriately.   Delays  embedded  in  the
718       capabilities  cr,  sf,  le, ff, and ta will cause the appropriate delay
719       bits to be set in the terminal driver.  If pb (padding  baud  rate)  is
720       given, these values can be ignored at baud rates below the value of pb.
721       For 4.2BSD tset, the delays are given as numeric capabilities  dC,  dN,
722       dB, dF, and dT instead.
723
724       Miscellaneous
725
726       If  the  terminal  requires other than a NUL (zero) character as a pad,
727       this can be given as pc.  Only the first character of the pc string  is
728       used.
729
730       If  the  terminal  has commands to save and restore the position of the
731       cursor, give them as sc and rc.
732
733       If the terminal has an extra “status line” that is not normally used by
734       software,  this fact can be indicated.  If the status line is viewed as
735       an extra line below the bottom line, then the capability hs  should  be
736       given.   Special  strings to go to a position in the status line and to
737       return from the status line can be given as ts and fs.  (fs must  leave
738       the cursor position in the same place that it was before ts.  If neces‐
739       sary, the sc and rc strings can be included in ts and fs  to  get  this
740       effect.)   The  capability  ts takes one parameter, which is the column
741       number of the status line to which the  cursor  is  to  be  moved.   If
742       escape  sequences  and other special commands such as tab work while in
743       the status line, the flag es can be given.  A string that turns off the
744       status  line  (or otherwise erases its contents) should be given as ds.
745       The status line is normally assumed to be the same width as the rest of
746       the  screen, i.e., co.  If the status line is a different width (possi‐
747       bly because the terminal does not allow an entire line to  be  loaded),
748       then  its  width in columns can be indicated with the numeric parameter
749       ws.
750
751       If the terminal can move up or down half a line, this can be  indicated
752       with hu (half-line up) and hd (half-line down).  This is primarily use‐
753       ful for superscripts and subscripts on hardcopy terminals.  If a  hard‐
754       copy  terminal  can eject to the next page (form feed), give this as ff
755       (usually ^L).
756
757       If there is a command to repeat a given character  a  given  number  of
758       times  (to  save  time transmitting a large number of identical charac‐
759       ters), this can be indicated with the  parameterized  string  rp.   The
760       first  parameter  is the character to be repeated and the second is the
761       number of times to repeat it.  (This is  a  terminfo  feature  that  is
762       unlikely to be supported by a program that uses termcap.)
763
764       If the terminal has a settable command character, such as the Tektronix
765       4025, this can be indicated with CC.  A prototype command character  is
766       chosen  which  is used in all capabilities.  This character is given in
767       the CC capability to identify it.  The  following  convention  is  sup‐
768       ported on some UNIX systems: The environment is to be searched for a CC
769       variable, and if found, all occurrences of the prototype character  are
770       replaced by the character in the environment variable.  This use of the
771       CC environment variable is a  very  bad  idea,  as  it  conflicts  with
772       make(1).
773
774       Terminal  descriptions  that  do not represent a specific kind of known
775       terminal, such as switch, dialup, patch, and  network,  should  include
776       the  gn (generic) capability so that programs can complain that they do
777       not know how to talk to the terminal.  (This capability does not  apply
778       to  virtual  terminal  descriptions  for which the escape sequences are
779       known.)
780
781       If the terminal uses xoff/xon (DC3/DC1) handshaking for  flow  control,
782       give xo.  Padding information should still be included so that routines
783       can make better decisions about costs, but actual pad  characters  will
784       not be transmitted.
785
786       If the terminal has a “meta key” which acts as a shift key, setting the
787       8th bit of any character transmitted, then this fact can  be  indicated
788       with  km.   Otherwise,  software will assume that the 8th bit is parity
789       and it will usually be cleared.  If strings exist to  turn  this  “meta
790       mode” on and off, they can be given as mm and mo.
791
792       If the terminal has more lines of memory than will fit on the screen at
793       once, the number of lines of memory  can  be  indicated  with  lm.   An
794       explicit  value  of  0 indicates that the number of lines is not fixed,
795       but that there is still more memory than fits on the screen.
796
797       If the terminal is one of those supported by the  UNIX  system  virtual
798       terminal protocol, the terminal number can be given as vt.
799
800       Media  copy strings which control an auxiliary printer connected to the
801       terminal can be given as ps: print the contents of the screen; pf: turn
802       off  the printer; and po: turn on the printer.  When the printer is on,
803       all text sent to the terminal will be sent to the printer.  It is unde‐
804       fined  whether  the  text is also displayed on the terminal screen when
805       the printer is on.  A variation pO takes one parameter and  leaves  the
806       printer  on  for as many characters as the value of the parameter, then
807       turns the printer off.  The parameter should not exceed 255.  All text,
808       including  pf,  is  transparently  passed to the printer while pO is in
809       effect.
810
811       Strings to program function keys can be given as pk, pl, and px.   Each
812       of  these strings takes two parameters: the function key number to pro‐
813       gram (from 0 to 9) and the string to program  it  with.   Function  key
814       numbers  out  of  this  range may program undefined keys in a terminal-
815       dependent manner.  The differences among the capabilities are  that  pk
816       causes  pressing  the  given  key to be the same as the user typing the
817       given string; pl causes the string to be executed by  the  terminal  in
818       local mode; and px causes the string to be transmitted to the computer.
819       Unfortunately, due to lack of a definition  for  string  parameters  in
820       termcap, only terminfo supports these capabilities.
821
822       Glitches and Braindamage
823
824       Hazeltine terminals, which do not allow `~' characters to be displayed,
825       should indicate hz.
826
827       The nc capability, now obsolete, formerly  indicated  Datamedia  termi‐
828       nals,  which  echo  \r  \n  for carriage return then ignore a following
829       linefeed.
830
831       Terminals that ignore a linefeed immediately after an am wrap, such  as
832       the Concept, should indicate xn.
833
834       If  ce  is  required  to get rid of standout (instead of merely writing
835       normal text on top of it), xs should be given.
836
837       Teleray terminals, where tabs turn all characters moved over to blanks,
838       should  indicate  xt  (destructive tabs).  This glitch is also taken to
839       mean that it is not possible to position the cursor on top of a  “magic
840       cookie”,  and that to erase standout mode it is necessary to use delete
841       and insert line.
842
843       The Beehive Superbee, which is unable to correctly transmit the ESC  or
844       ^C characters, has xb, indicating that the “f1” key is used for ESC and
845       “f2” for ^C.  (Only certain Superbees have this problem,  depending  on
846       the ROM.)
847
848       Other  specific terminal problems may be corrected by adding more capa‐
849       bilities of the form xx.
850
851       Similar Terminals
852
853       If there are two very similar terminals, one can be  defined  as  being
854       just  like the other with certain exceptions.  The string capability tc
855       can be given with the name of the similar  terminal.   This  capability
856       must  be  last,  and the combined length of the entries must not exceed
857       1024.  The capabilities given before tc override those in the  terminal
858       type invoked by tc.  A capability can be canceled by placing xx@ to the
859       left of the tc invocation, where xx is the  capability.   For  example,
860       the entry
861
862            hn|2621-nl:ks@:ke@:tc=2621:
863
864       defines a “2621-nl” that does not have the ks or ke capabilities, hence
865       does not turn on the function key labels when in visual mode.  This  is
866       useful  for different modes for a terminal, or for different user pref‐
867       erences.
868

AUTHOR

870       William Joy
871       Mark Horton added underlining and keypad support
872

FILES

874       /etc/termcap   file containing terminal descriptions
875

SEE ALSO

877       ex(1), more(1), tset(1), ul(1), vi(1), curses(3X), printf(3S), term(7).
878

CAVEATS AND BUGS

880       Note: termcap was replaced by terminfo in UNIX System  V  Release  2.0.
881       The  transition  will be relatively painless if capabilities flagged as
882       “obsolete” are avoided.
883
884       Lines and columns are now stored by the kernel as well as in the  term‐
885       cap entry.  Most programs now use the kernel information primarily; the
886       information in this file is used only if the kernel does not  have  any
887       information.
888
889       Vi allows only 256 characters for string capabilities, and the routines
890       in termlib(3) do not check for overflow  of  this  buffer.   The  total
891       length  of  a  single  entry  (excluding only escaped newlines) may not
892       exceed 1024.
893
894       Not all programs support all entries.
895
896
897
8983rd Berkeley Distribution       1 November 1985                     TERMCAP(5)
Impressum