1 .\" $NetBSD: termcap.5,v 1.34 2003/08/07 10:31:32 agc Exp $
3 .\" Copyright (c) 1985, 1991, 1993, 1994
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" from: @(#)termcap.5 8.3 (Berkeley) 4/16/94
37 .Nd terminal capability data base
43 file is a database describing terminals, used, for example, by
47 Terminals are described in
49 by giving a set of capabilities that they have and by describing
50 how operations are performed.
51 Padding requirements and initialization sequences
57 consist of a number of `:'-separated fields.
58 The first entry for each terminal gives the names that are known for the
59 terminal, separated by `|' characters.
60 The first name given is the most common abbreviation for the terminal.
61 The last name given should be a long name fully identifying the terminal,
62 and all others are understood as synonyms for the terminal name.
63 All names but the last should be in lower case and contain no blanks;
64 the last name may well contain upper case characters and blanks for
67 Terminal names (except for the last, verbose entry)
68 should be chosen using the following conventions.
69 The particular piece of hardware making up the terminal
70 should have a root name chosen, thus
72 This name should not contain hyphens.
73 Modes that the hardware can be in
75 should be indicated by appending a hyphen and an indicator of the mode.
78 in 132-column mode would be
80 The following suffixes should be used where possible:
82 .Bl -column indent "With automatic margins (usually default)xx"
83 .It Sy Suffix Meaning Example
84 .It -w Wide mode (more than 80 columns) vt100-w
85 .It -am With automatic margins (usually default) vt100-am
86 .It -nam Without automatic margins vt100-nam
87 .It \- Ns Ar n Ta No "Number of lines on screen aaa-60"
88 .It -na No arrow keys (leave them in local) concept100-na
89 .It \- Ns Ar \&np Ta No "Number of pages of memory concept100-4p"
90 .It -rv Reverse video concept100-rv
96 field in the table have the following meanings
97 (more than one may apply to a capability):
99 .Bd -unfilled -offset indent
100 N indicates numeric parameter(s)
101 P indicates that padding may be specified
102 * indicates that padding may be based on the number of lines affected
103 o indicates capability is obsolete
110 since they were considered useless,
111 or are subsumed by other capabilities.
112 New software should not rely on them at all.
114 .Bl -column indent indent indent
115 .It Sy Name Type Notes Description
116 .It "!1 str Sent by shifted save key."
117 .It "!2 str Sent by shifted suspend key."
118 .It "!3 str Sent by shifted undo key."
119 .It "#1 str Sent by shifted help key."
120 .It "#2 str Sent by shifted home key."
121 .It "#3 str Sent by shifted input key."
122 .It "#4 str Sent by shifted left-arrow key."
123 .It "%0 str Sent by redo key."
124 .It "%1 str Sent by help key."
125 .It "%2 str Sent by mark key."
126 .It "%3 str Sent by message key."
127 .It "%4 str Sent by move key."
128 .It "%5 str Sent by next-object key."
129 .It "%6 str Sent by open key."
130 .It "%7 str Sent by options key."
131 .It "%8 str Sent by previous-object key."
132 .It "%9 str Sent by print or copy key."
133 .It "%a str Sent by shifted message key."
134 .It "%b str Sent by shifted move key."
135 .It "%c str Sent by shifted next key."
136 .It "%d str Sent by shifted options key."
137 .It "%e str Sent by shifted prev key."
138 .It "%f str Sent by shifted print key."
139 .It "%g str Sent by shifted redo key."
140 .It "%h str Sent by shifted replace key."
141 .It "%i str Sent by shifted right-arrow key."
142 .It "%j str Sent by shifted resume key."
143 .It "\*[Am]0 str Sent by shifted cancel key."
144 .It "\*[Am]1 str Sent by ref(erence) key."
145 .It "\*[Am]2 str Sent by refresh key."
146 .It "\*[Am]3 str Sent by replace key."
147 .It "\*[Am]4 str Sent by restart key."
148 .It "\*[Am]5 str Sent by resume key."
149 .It "\*[Am]6 str Sent by save key."
150 .It "\*[Am]7 str Sent by suspend key."
151 .It "\*[Am]8 str Sent by undo key."
152 .It "\*[Am]9 str Sent by shifted begin key."
153 .It "*0 str Sent by shifted find key."
154 .It "*1 str Sent by shifted command key."
155 .It "*2 str Sent by shifted copy key."
156 .It "*3 str Sent by shifted create key."
157 .It "*4 str Sent by shifted delete-character key."
158 .It "*5 str Sent by shifted delete-line key."
159 .It "*6 str Sent by shifted select key."
160 .It "*7 str Sent by shifted end key."
161 .It "*8 str Sent by shifted clear-to-end-of-line key."
162 .It "*9 str Sent by shifted exit key."
163 .It "@0 str Sent by find key."
164 .It "@1 str Sent by begin key."
165 .It "@2 str Sent by cancel key."
166 .It "@3 str Sent by close key."
167 .It "@4 str Sent by command key."
168 .It "@5 str Sent by copy key."
169 .It "@6 str Sent by create key."
170 .It "@7 str Sent by end key."
171 .It "@8 str Sent by enter key."
172 .It "@9 str Sent by exit key."
173 .It "AB str Set background color to #1 using ANSI escape."
174 .It "ac str Alternative (graphic) character set pairs."
175 .It "ae str (P) End alternative character set."
176 .It AL str (NP*) Add"
179 .It "AF str Set foreground color to #1 using ANSI escape."
180 .It "al str (P*) Add new blank line."
181 .It "am bool Terminal has automatic margins."
182 .It "as str (P) Start alternative character set."
183 .It "bc str (o) Backspace if not"
185 .It "bl str (P) Audible signal (bell)."
186 .It "bs bool (o) Terminal can backspace with"
188 .It "bt str (P) Back tab."
189 .It "bw bool " Ta Sy \&le
190 (backspace) wraps from column 0 to last column.
191 .It "CC str Terminal settable command character in prototype."
192 .It "cc bool Terminal can re-define existing color."
193 .It "cd str (P*) Clear to end of display."
194 .It "ce str (P) Clear to end of line."
195 .It "ch str (NP) Set cursor column (horizontal position)."
196 .It "cl str (P*) Clear screen and home cursor."
197 .It "CM str (NP) Memory-relative cursor addressing."
198 .It "cm str (NP) Screen-relative cursor motion."
199 .It "Co num Maximum number of colors on the screen."
200 .It "co num Number of columns in a line (See"
203 .It "cr str (P) Carriage return."
204 .It "cs str (NP) Change scrolling region (VT100)."
205 .It "ct str (P) Clear all tab stops."
206 .It "cv str (NP) Set cursor row (vertical position)."
207 .It "da bool Display may be retained above the screen."
208 .It "dB num (o) Milliseconds of"
210 delay needed (default 0).
211 .It "db bool Display may be retained below the screen."
212 .It "DC str (NP*) Delete"
215 .It "dC num (o) Milliseconds of"
217 delay needed (default 0).
218 .It "dc str (P*) Delete character."
219 .It "dF num (o) Milliseconds of"
221 delay needed (default 0).
222 .It "DL str (NP*) Delete"
225 .It "dl str (P*) Delete line."
226 .It "dm str Enter delete mode."
227 .It "dN num (o) Milliseconds of"
229 delay needed (default 0).
230 .It "DO str (NP*) Move cursor down:"
233 .It "do str Down one line."
234 .It "ds str Disable status line."
235 .It "dT num (o) Milliseconds of horizontal tab delay needed (default 0)."
236 .It "dV num (o) Milliseconds of vertical tab delay needed (default 0)."
237 .It "eA str Enable alternate character set."
238 .It "ec str (NP) Erase"
241 .It "ed str End delete mode."
242 .It "ei str End insert mode."
243 .It "eo bool Can erase overstrikes with a blank."
244 .It "EP bool (o) Even parity."
245 .It "es bool Escape can be used on the status line."
246 .It "F1-F9 str Sent by function keys 11-19."
247 .It "FA-FZ str Sent by function keys 20-45."
248 .It "Fa-Fr str Sent by function keys 46-63."
249 .It "ff str (P*) Hardcopy terminal page eject."
250 .It "fs str Return from status line."
251 .It "gn bool Generic line type, for example dialup, switch)."
252 .It "hc bool Hardcopy terminal."
253 .It "HD bool (o) Half-duplex."
254 .It "hd str Half-line down (forward 1/2 linefeed)."
255 .It "hl bool Terminal uses only HLS color notation (Tektronix)."
256 .It "ho str (P) Home cursor."
257 .It "hs bool Has extra"
259 .It "hu str Half-line up (reverse 1/2 linefeed)."
260 .It "hz bool Cannot print ``~'' (Hazeltine)."
261 .It "i1-i3 str Terminal initialization strings"
264 .It "IC str (NP*) Insert"
267 .It "Ic str Set color #1 to RGB #2, #3, #4."
268 .It "ic str (P*) Insert character."
269 .It "if str Name of file containing initialization string."
270 .It "im str Enter insert mode."
271 .It "in bool Insert mode distinguishes nulls."
272 .It "Ip str Set color-pair #1 to fg #2, bg #3."
273 .It "iP str Pathname of program for initialization"
276 .It "ip str (P*) Insert pad after character inserted."
277 .It "is str Terminal initialization string"
280 .It "it num Tabs initially every"
283 .It "K1 str Sent by keypad upper left."
284 .It "K2 str Sent by keypad center."
285 .It "K3 str Sent by keypad upper right."
286 .It "K4 str Sent by keypad lower left."
287 .It "K5 str Sent by keypad lower right."
288 .It "k0-k9 str Sent by function keys 0-9."
289 .It "k; str Sent by function key 10."
290 .It "kA str Sent by insert-line key."
291 .It "ka str Sent by clear-all-tabs key."
292 .It "kB str Sent by back-tab key."
293 .It "kb str Sent by backspace key."
294 .It "kC str Sent by clear-screen or erase key."
295 .It "kD str Sent by delete-character key."
296 .It "kd str Sent by down-arrow key."
297 .It "kE str Sent by clear-to-end-of-line key."
301 .It "kF str Sent by scroll-forward/down key."
302 .It "kH str Sent by home-down key."
303 .It "kh str Sent by home key."
304 .It "kI str Sent by insert-character or enter-insert-mode key."
305 .It "kL str Sent by delete-line key."
306 .It "kl str Sent by left-arrow key."
307 .It "kM str Sent by insert key while in insert mode."
308 .It "Km str Mouse event has occurred."
311 key (shift, sets parity bit).
312 .It "kN str Sent by next-page key."
313 .It "kn num (o) Number of function"
314 .Pq Sy \&k\&0 Ns \- Sy \&k\&9
316 .It "ko str (o) Termcap entries for other non-function keys."
317 .It "kP str Sent by previous-page key."
318 .It "kR str Sent by scroll-backward/up key."
319 .It "kr str Sent by right-arrow key."
320 .It "kS str Sent by clear-to-end-of-screen key."
321 .It "ks str Put terminal in"
324 .It "kT str Sent by set-tab key."
325 .It "kt str Sent by clear-tab key."
326 .It "ku str Sent by up-arrow key."
327 .It "l0-l9 str Labels on function keys if not"
329 .It "LC bool (o) Lower-case only."
330 .It "LE str (NP) Move cursor left"
333 .It "le str (P) Move cursor left one position."
334 .It "li num Number of lines on screen or page (See"
337 .It "ll str Last line, first column
338 .It "lm num Lines of memory if \*[Gt]" Sy \&li
340 .It "ma str (o) Arrow key map (used by"
343 .It "mb str Turn on blinking attribute."
344 .It "md str Turn on bold (extra bright) attribute."
345 .It "me str Turn off all attributes."
346 .It "mh str Turn on half-bright attribute."
347 .It "mi bool Safe to move while in insert mode."
348 .It "mk str Turn on blank attribute (characters invisible)."
349 .It "ml str (o) Memory lock on above cursor."
353 .It "mo str Turn off"
355 .It "mp str Turn on protected attribute."
356 .It "mr str Turn on reverse-video attribute."
357 .It "ms bool Safe to move in standout modes."
358 .It "mu str (o) Memory unlock (turn off memory lock)."
359 .It "NC num Video attributes that can't be used with colors"
360 .It "nc bool (o) No correctly-working"
362 (Datamedia 2500, Hazeltine 2000).
363 .It "nd str Non-destructive space (cursor right)."
364 .It "NL bool (o)" Ta Sy \&\en No "is newline, not line feed."
365 .It "nl str (o) Newline character if not" Sy \en .
366 .It "ns bool (o) Terminal is a" Tn CRT No "but doesn't scroll."
367 .It "nw str (P) Newline (behaves like"
371 .It "OP bool (o) Odd parity."
372 .It "oc str Set all colors to the original ones."
373 .It "op str Set default color-pair to the original one."
374 .It "os bool Terminal overstrikes."
375 .It "pa num Maximum number of color-pairs on the screen."
376 .It "pb num Lowest baud where delays are required."
377 .It "pc str Pad character (default" Tn NUL ) .
378 .It "pf str Turn off the printer."
379 .It "pk str Program function key"
385 .It "pl str Program function key"
391 .It "pO str (N) Turn on the printer for"
394 .It "po str Turn on the printer."
395 .It "ps str Print contents of the screen."
396 .It "pt bool (o) Has hardware tabs (may need to be set with"
398 .It "px str Program function key"
404 .It "r1-r3 str Reset terminal completely to sane modes"
407 .It "rc str (P) Restore cursor to position of last"
409 .It "rf str Name of file containing reset codes."
410 .It "RI str (NP) Move cursor right"
413 .It "rp str (NP*) Repeat character"
416 .It "rs str Reset terminal completely to sane modes"
419 .It "sa str (NP) Define the video attributes."
420 .It "Sb str Set background color to #1."
421 .It "sc str (P) Save cursor position."
422 .It "se str End standout mode."
423 .It "Sf str Set foreground color to #1."
424 .It "SF str (NP*) Scroll forward"
427 .It "sf str (P) Scroll text up."
428 .It "sg num Number of garbage chars left by"
433 .It "so str Begin standout mode."
434 .It "SR str (NP*) Scroll backward"
437 .It "sr str (P) Scroll text down."
438 .It "st str Set a tab in all rows, current column."
439 .It "ta str (P) Tab to next 8-position hardware tab stop."
440 .It "tc str Entry of similar terminal \- must be last."
441 .It "te str String to end programs that use"
443 .It "ti str String to begin programs that use"
445 .It "ts str (N) Go to status line, column"
447 .It "UC bool (o) Upper-case only."
448 .It "uc str Underscore one character and move past it."
449 .It "ue str End underscore mode."
450 .It "ug num Number of garbage chars left by"
455 .It "ul bool Underline character overstrikes."
456 .It "UP str (NP*) Move cursor up"
459 .It "up str Upline (cursor up)."
460 .It "us str Start underscore mode."
461 .It "ut bool Screen erased with background color."
462 .It "vb str Visible bell (must not move cursor)."
463 .It "ve str Make cursor appear normal (undo"
464 .Sy \&vs Ns / Sy \&vi ) .
465 .It "vi str Make cursor invisible."
466 .It "vs str Make cursor very visible."
467 .It "vt num Virtual terminal number (not supported on all systems)."
468 .It "wi str (N) Set current window."
469 .It "ws num Number of columns in status line."
470 .It "xb bool Beehive"
472 .Pf "f2=" Sy \&^C ) .
473 .It "xn bool Newline ignored after 80 cols (Concept)."
474 .It "xo bool Terminal uses xoff/xon"
475 .Pq Dv DC3 Ns / Ns Dv DC1
477 .It "xr bool (o) Return acts like"
480 .It "xs bool Standout not erased by overwriting (Hewlett-Packard)."
481 .It "xt bool Tabs ruin, magic"
484 .It "xx bool (o) Tektronix 4025 insert-line."
485 .It "ZZ str Pointer to the extended termcap entry. See"
490 The following entry, which describes the Concept\-100, is among the more
491 complex entries in the
493 file as of this writing.
496 ca\||\|concept100\||\|c100\||\|concept\||\|c104\||\|concept100-4p\||\|HDS Concept\-100:\e
497 :al=3*\eE^R:am:bl=^G:cd=16*\eE^C:ce=16\eE^U:cl=2*^L:cm=\eEa%+ %+ :\e
498 :co#80:.cr=9^M:db:dc=16\eE^A:dl=3*\eE^B:do=^J:ei=\eE\e200:eo:im=\eE^P:in:\e
499 :ip=16*:is=\eEU\eEf\eE7\eE5\eE8\eEl\eENH\eEK\eE\e200\eEo\*[Am]\e200\eEo\e47\eE:k1=\eE5:\e
500 :k2=\eE6:k3=\eE7:kb=^h:kd=\eE\*[Lt]:ke=\eEx:kh=\eE?:kl=\eE\*[Gt]:kr=\eE=:ks=\eEX:\e
501 :ku=\eE;:le=^H:li#24:mb=\eEC:me=\eEN\e200:mh=\eEE:mi:mk=\eEH:mp=\eEI:\e
502 :mr=\eED:nd=\eE=:pb#9600:rp=0.2*\eEr%.%+ :se=\eEd\eEe:sf=^J:so=\eEE\eED:\e
503 :.ta=8\et:te=\eEv \e200\e200\e200\e200\e200\e200\eEp\er\en:\e
504 :ti=\eEU\eEv 8p\eEp\er:ue=\eEg:ul:up=\eE;:us=\eEG:\e
505 :vb=\eEk\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\eEK:\e
506 :ve=\eEw:vs=\eEW:vt#8:xn:\e
507 :bs:cr=^M:dC#9:dT#8:nl=^J:ta=^I:pt:
510 Entries may continue onto multiple lines by giving a \e as the last
511 character of a line, and empty fields
512 may be included for readability (here between the last field on a line
513 and the first field on the next).
514 Comments may be included on lines beginning with
516 .Ss Types of Capabilities
519 are of three types: Boolean capabilities,
520 which indicate particular features that the terminal has;
521 numeric capabilities,
522 giving the size of the display or the size of other attributes;
523 and string capabilities,
524 which give character sequences that can be used to perform particular
526 All capabilities have two-letter codes.
527 For instance, the fact that
529 .Em automatic margins
530 (an automatic return and linefeed
531 when the end of a line is reached) is indicated by the Boolean capability
533 Hence the description of the Concept includes
536 Numeric capabilities are followed by the character `#' then the value.
539 which indicates the number of columns the display has,
540 gives the value `80' for the Concept.
542 Finally, string-valued capabilities, such as
544 (clear-to-end-of-line
545 sequence) are given by the two-letter code, an `=', then a string
546 ending at the next following `:'.
547 A delay in milliseconds may appear after
548 the `=' in such a capability,
549 which causes padding characters to be supplied by
551 after the remainder of the string is sent to provide this delay.
552 The delay can be either a number,
553 such as `20', or a number followed by
556 An `*' indicates that the padding required is proportional
557 to the number of lines affected by the operation, and the amount given is
558 the per-affected-line padding required.
559 (In the case of insert-character,
560 the factor is still the number of
563 this is always 1 unless the terminal has
565 and the software uses it.)
566 When an `*' is specified, it is sometimes useful to give a delay of the form
567 `3.5' to specify a delay per line to tenths of milliseconds.
568 (Only one decimal place is allowed.)
570 A number of escape sequences are provided in the string-valued capabilities
571 for easy encoding of control characters there.
577 maps to a control-X for any appropriate X,
584 map to linefeed, return, tab, backspace, and formfeed, respectively.
585 Finally, characters may be given as three octal digits after a
595 If it is necessary to place a
597 in a capability it must be escaped in
600 If it is necessary to place a
602 character in a string capability it
605 (The routines that deal with
607 use C strings and strip the high bits of the output very late, so that
614 Sometimes individual capabilities must be commented out.
615 To do this, put a period before the capability name.
616 For example, see the first
620 in the example above.
621 .Ss Preparing Descriptions
622 The most effective way to prepare a terminal description is by imitating
623 the description of a similar terminal in
625 and to build up a description gradually, using partial descriptions
628 to check that they are correct.
629 Be aware that a very unusual terminal may expose deficiencies in
635 To easily test a new terminal description you are working on
636 you can put it in your home directory in a file called
638 and programs will look there before looking in
639 .Pa /usr/share/misc/termcap .
640 You can also set the environment variable
642 to a list of absolute file pathnames (separated by spaces or colons),
643 one of which contains the description you are working on,
644 and programs will search them in the order listed, and nowhere else.
649 environment variable is usually set to the
652 to avoid reading files when starting up a program.
654 To get the padding for insert-line right
655 (if the terminal manufacturer did not document it),
656 a severe test is to use
660 at 9600 baud, delete roughly 16 lines from the middle of the screen,
661 then hit the `u' key several times quickly.
662 If the display messes up, more padding is usually needed.
663 A similar test can be used for insert-character.
664 .Ss Basic Capabilities
665 The number of columns on each line of the display is given by the
671 number of lines on the screen is given by the
674 If the display wraps around to the beginning of the next line when
675 the cursor reaches the right margin, then it should have the
678 If the terminal can clear its screen,
679 the code to do this is given by the
682 If the terminal overstrikes
683 (rather than clearing the position when a character is overwritten),
687 If the terminal is a printing terminal,
688 with no soft copy unit,
694 applies to storage scope terminals,
695 such as the Tektronix 4010 series,
696 as well as to hard copy and
699 If there is a code to move the cursor to the left edge of the current row,
702 (Normally this will be carriage-return,
704 If there is a code to produce an audible signal (bell, beep,
709 If there is a code (such as backspace)
710 to move the cursor one position to the left,
711 that capability should be given as
714 codes to move to the right, up, and down
722 .Em local cursor motions
723 should not alter the text they pass over;
724 for example, you would not normally use
726 unless the terminal has the
729 because the space would erase the character moved over.
731 A very important point here is that the local cursor motions encoded
734 have undefined behavior at the left and top edges of a
737 Programs should never attempt to backspace around the left edge,
740 is given, and never attempt to go up off the top
741 using local cursor motions.
743 In order to scroll text up,
744 a program goes to the bottom left corner of the screen and sends the
748 a program goes to the top left corner of the screen and sends the
750 (reverse index) string.
755 have undefined behavior
756 when not on their respective corners of the screen.
757 Parameterized versions of the scrolling sequences are
761 which have the same semantics as
765 except that they take one parameter
766 and scroll that many lines.
767 They also have undefined behavior
768 except at the appropriate corner of the screen.
772 capability tells whether the cursor sticks at the right
773 edge of the screen when text is output there,
774 but this does not necessarily apply to
776 from the last column.
777 Leftward local motion is defined from the left edge only when
781 from the left edge will move to the right edge of the previous row.
782 This is useful for drawing a box around the edge of the screen,
784 If the terminal has switch-selectable automatic margins,
787 description usually assumes that this feature is on, i.e.,
789 If the terminal has a command
790 that moves to the first column of the next line,
791 that command can be given as
794 It is permissible for this to clear the remainder of the current line,
795 so if the terminal has no correctly-working
799 it may still be possible to craft a working
801 out of one or both of them.
803 These capabilities suffice to describe hardcopy and
806 Thus the Teletype model 33 is described as
807 .Bd -literal -offset indent
808 T3\||\|tty33\||\|33\||\|tty\||\|Teletype model 33:\e
809 :bl=^G:co#72:cr=^M:do=^J:hc:os:
815 .Bd -literal -offset indent
816 l3\||\|adm3\||\|3\||\|LSI \s-1ADM\s0-3:\e
817 :am:bl=^G:cl=^Z:co#80:cr=^M:do=^J:le=^H:li#24:sf=^J:
819 .Ss Parameterized Strings
820 Cursor addressing and other strings requiring parameters
822 parameterized string capability, with
823 .Xr printf 3 Ns \-like
827 while other characters are passed through unchanged.
828 For example, to address the cursor the
830 capability is given, using two parameters: the row and column to move to.
831 (Rows and columns are numbered from zero and refer to the physical screen
832 visible to the user, not to any unseen memory.
833 If the terminal has memory-relative cursor addressing,
834 that can be indicated by an analogous
840 encodings have the following meanings:
843 .It "%d output value as in"
846 .It "%2 output value as in"
849 .It "%3 output value as in"
852 .It "%. output value as in"
855 .It "%+" Ns Em x Ta No add
858 .It "%\*[Gt]" Ns Em \&xy Ta No if
864 .It "\&%r reverse order of two parameters, no output"
865 .It "\&%i increment by one, no output"
866 .It "\&%n exclusive-or all parameters with 0140 (Datamedia 2500)"
867 .It "\&%B" Ta Tn BCD No "(16*(value/10)) + (value%10), no output"
868 .It "\&%D Reverse coding (value \- 2*(value%16)), no output (Delta Data)."
871 Consider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needs
874 padded for 6 milliseconds.
876 of the row and column coordinates is reversed here
877 and that the row and column
878 are sent as two-digit integers.
882 .Dq Li cm=6\eE\*[Am]%r%2c%2Y .
884 The Datamedia 2500 needs the current row and column sent
885 encoded in binary using
892 and to move the cursor up one line on the screen
894 This is necessary because it is not always safe to transmit
899 as the system may change or discard them.
902 must set terminal modes so that tabs are not expanded, so
905 This turns out to be essential for the Ann Arbor 4080.)
907 A final example is the Lear Siegler
909 which offsets row and column
910 by a blank character, thus
911 .Dq Li cm=\eE=%+ %+\ \& .
913 Row or column absolute cursor addressing
914 can be given as single parameter capabilities
916 (horizontal position absolute) and
918 (vertical position absolute).
919 Sometimes these are shorter than the more general two-parameter sequence
920 (as with the Hewlett-Packard 2645) and can be used in preference to
922 If there are parameterized local motions (e.g., move
924 positions to the right)
925 these can be given as
931 with a single parameter indicating how many positions to move.
932 These are primarily useful if the terminal does not have
934 such as the Tektronix 4025.
936 If the terminal has a fast way to home the cursor
937 (to the very upper left corner of the screen), this can be given as
939 Similarly, a fast way of getting to the lower left-hand corner
942 this may involve going up with
944 from the home position,
945 but a program should never do this itself (unless
947 does), because it can
948 make no assumption about the effect of moving up from the home position.
949 Note that the home position is the same as
950 cursor address (0,0): to the top left corner of the screen, not of memory.
953 sequence on Hewlett-Packard terminals
957 If the terminal can clear from the current position to the end of the
958 line, leaving the cursor where it is, this should be given as
960 If the terminal can clear from the current position to the end of the
961 display, this should be given as
964 must only be invoked from the first column of a line.
966 it can be simulated by a request to delete a large number of lines,
970 .Ss Insert/Delete Line
971 If the terminal can open a new blank line
972 before the line containing the cursor,
973 this should be given as
975 this must be invoked only from the first
977 The cursor must then appear at the left of the newly blank line.
978 If the terminal can delete the line that the cursor is on, this
981 this must only be used from the first position on
982 the line to be deleted.
987 which take a single parameter
988 and insert or delete that many lines
993 If the terminal has a settable scrolling region
995 the command to set this can be described with the
998 which takes two parameters: the top and bottom lines of the scrolling region.
999 The cursor position is, alas, undefined after using this command.
1000 It is possible to get the effect of insert or delete line
1001 using this command \(em the
1005 (save and restore cursor) commands are also useful.
1006 Inserting lines at the top or bottom of the screen can also be done using
1010 on many terminals without a true insert/delete line,
1011 and is often faster even on terminals with those features.
1013 If the terminal has the ability to define a window as part of memory
1014 which all commands affect, it should be given as the parameterized string
1016 The four parameters are the starting and ending lines in memory
1017 and the starting and ending columns in memory, in that order.
1020 capability is described for completeness.
1021 It is unlikely that any
1023 program will support it.)
1025 If the terminal can retain display memory above the screen, then the
1027 capability should be given;
1028 if display memory can be retained
1033 that deleting a line or scrolling may bring non-blank lines up from below
1034 or that scrolling back with
1036 may bring down non-blank lines.
1037 .Ss Insert/Delete Character
1038 There are two basic kinds of intelligent terminals with respect to
1039 insert/delete character that can be described using
1041 The most common insert/delete character operations affect only the characters
1042 on the current line and shift characters off the end of the line rigidly.
1043 Other terminals, such as the Concept\-100 and the Perkin Elmer Owl, make
1044 a distinction between typed and untyped blanks on the screen, shifting
1045 upon an insert or delete only to an untyped blank on the screen which is
1046 either eliminated or expanded to two untyped blanks.
1048 the kind of terminal you have by clearing the screen then typing
1049 text separated by cursor motions.
1051 .Dq Li abc\ \ \ \ def
1053 cursor motions (not spaces) between the
1057 Then position the cursor before the
1059 and put the terminal in insert
1061 If typing characters causes the rest of the line to shift
1062 rigidly and characters to fall off the end, then your terminal does
1063 not distinguish between blanks and untyped positions.
1068 which then move together around the end of the
1069 current line and onto the next as you insert, then you have the second type of
1070 terminal and should give the capability
1074 While these are two logically separate attributes
1075 (one-line vs. multi-line insert mode,
1076 and special treatment of untyped spaces),
1077 we have seen no terminals whose insert
1078 mode cannot be described with the single attribute.
1081 can describe both terminals that have an insert mode and terminals
1082 that send a simple sequence to open a blank position on the current line.
1085 the sequence to get into insert mode.
1088 the sequence to leave insert mode.
1091 any sequence that needs to be sent just before
1092 each character to be inserted.
1093 Most terminals with a true insert mode
1096 terminals that use a sequence to open a screen
1097 position should give it here.
1098 (If your terminal has both,
1099 insert mode is usually preferable to
1101 Do not give both unless the terminal actually requires both to be used
1103 If post-insert padding is needed, give this as a number of milliseconds
1107 Any other sequence that may need to be
1108 sent after insertion of a single character can also be given in
1110 If your terminal needs to be placed into an `insert mode'
1111 and needs a special code preceding each inserted character,
1113 .Sy \&im Ns / Sy \&ei
1116 can be given, and both will be used.
1119 capability, with one parameter
1121 will repeat the effects of
1126 It is occasionally necessary to move around while in insert mode
1127 to delete characters on the same line (e.g., if there is a tab after
1128 the insertion position).
1129 If your terminal allows motion while in
1130 insert mode, you can give the capability
1132 to speed up inserting
1136 will affect only speed.
1138 (notably Datamedia's) must not have
1140 because of the way their
1143 Finally, you can specify
1145 to delete a single character,
1152 and delete mode by giving
1156 to enter and exit delete mode
1157 (which is any mode the terminal needs to be placed in for
1160 .Ss Highlighting, Underlining, and Visible Bells
1161 If your terminal has one or more kinds of display attributes,
1162 these can be represented in a number of different ways.
1163 You should choose one display form as
1165 representing a good high-contrast, easy-on-the-eyes format
1166 for highlighting error messages and other attention getters.
1167 (If you have a choice, reverse video plus half-bright is good,
1168 or reverse video alone.)
1169 The sequences to enter and exit standout mode
1175 If the code to change into or out of standout
1176 mode leaves one or even two blank spaces or garbage characters on the screen,
1179 912 and Teleray 1061 do,
1182 should be given to tell how many characters are left.
1184 Codes to begin underlining and end underlining can be given as
1189 Underline mode change garbage is specified by
1193 If the terminal has a code to underline the current character and move
1194 the cursor one position to the right,
1195 such as the Microterm Mime,
1196 this can be given as
1199 Other capabilities to enter various highlighting modes include
1203 (bold or extra bright),
1205 (dim or half-bright),
1207 (blanking or invisible text),
1217 (enter alternative character set mode), and
1219 (exit alternative character set mode).
1220 Turning on any of these modes singly may or may not turn off other modes.
1222 If there is a sequence to set arbitrary combinations of mode,
1223 this should be given as
1225 (set attributes), taking 9 parameters.
1226 Each parameter is either 0 or 1,
1227 as the corresponding attributes is on or off.
1228 The 9 parameters are, in order: standout, underline, reverse, blink,
1229 dim, bold, blank, protect, and alternative character set.
1230 Not all modes need be supported by
1232 only those for which corresponding attribute commands exist.
1233 (It is unlikely that a
1235 program will support this capability, which is defined for compatibility
1245 rather than maintaining extra attribute bits for each character cell,
1246 instead deposit special
1249 .Dq garbage characters ,
1250 when they receive mode-setting sequences,
1251 which affect the display algorithm.
1254 such as the Hewlett-Packard 2621,
1255 automatically leave standout
1256 mode when they move to a new line or when the cursor is addressed.
1257 Programs using standout mode
1258 should exit standout mode on such terminals
1259 before moving the cursor or sending a newline.
1260 On terminals where this is not a problem,
1263 capability should be present
1264 to say that this overhead is unnecessary.
1267 a way of flashing the screen to indicate an error quietly
1268 (a bell replacement),
1269 this can be given as
1271 it must not move the cursor.
1273 If the cursor needs to be made more visible than normal
1274 when it is not on the bottom line
1275 (to change, for example, a non-blinking underline into an easier-to-find
1276 block or blinking underline),
1277 give this sequence as
1279 If there is a way to make the cursor completely invisible, give that as
1283 which undoes the effects of both of these modes,
1284 should also be given.
1286 If your terminal correctly displays underlined characters
1287 (with no special codes needed)
1288 even though it does not overstrike,
1289 then you should give the capability
1291 If overstrikes are erasable with a blank,
1292 this should be indicated by giving
1295 If the terminal has a keypad that transmits codes when the keys are pressed,
1296 this information can be given.
1297 Note that it is not possible to handle
1298 terminals where the keypad only works in local mode
1299 (this applies, for example, to the unshifted Hewlett-Packard 2621 keys).
1300 If the keypad can be set to transmit or not transmit,
1305 Otherwise the keypad is assumed to always transmit.
1306 The codes sent by the left-arrow, right-arrow, up-arrow, down-arrow,
1307 and home keys can be given as
1315 If there are function keys such as f0, f1, ..., f9, the codes they send
1321 If these keys have labels other than the default f0 through f9, the labels
1327 The codes transmitted by certain other special keys can be given:
1335 (clear the tab stop in this column),
1337 (clear screen or erase),
1345 (clear to end of line),
1347 (clear to end of screen),
1349 (insert character or enter insert mode),
1357 (scroll forward/down),
1359 (scroll backward/up), and
1361 (set a tab stop in this column).
1362 In addition, if the keypad has a 3 by 3 array of keys
1363 including the four arrow keys, then the other five keys can be given as
1370 These keys are useful when the effects of a 3 by 3 directional pad are needed.
1373 capability formerly used to describe
1375 function keys has been
1376 completely supplanted by the above capabilities.
1380 entry is also used to indicate arrow keys on terminals that have
1381 single-character arrow keys.
1382 It is obsolete but still in use in
1385 which must be run on some minicomputers due to
1387 This field is redundant with
1394 It consists of groups of two characters.
1395 In each group, the first character is what an arrow key sends, and the
1396 second character is the corresponding
1416 For example, the Mime would have
1417 .Dq Li ma=^Hh^Kj^Zk^Xl
1418 indicating arrow keys left (^H), down (^K), up (^Z), and right (^X).
1419 (There is no home key on the Mime.)
1420 .Ss Tabs and Initialization
1421 If the terminal needs to be in a special mode when running
1422 a program that uses these capabilities,
1423 the codes to enter and exit this mode can be given as
1427 This arises, for example, from terminals like the Concept with more than
1429 If the terminal has only memory-relative cursor addressing and not
1430 screen-relative cursor addressing,
1431 a screen-sized window must be fixed into
1432 the display for cursor addressing to work properly.
1433 This is also used for the Tektronix 4025, where
1435 sets the command character to be the one used by
1441 an initialization string for the terminal,
1444 the name of a file containing long initialization strings.
1445 These strings are expected to set the terminal into modes
1446 consistent with the rest of the
1449 They are normally sent to the terminal by the
1451 program each time the user logs in.
1452 They will be printed in the following order:
1465 and runs the program
1469 after the other initializations.)
1470 A pair of sequences that does a harder reset from a totally unknown state
1471 can be analogously given as
1475 These strings are output by the
1477 program, which is used when the terminal gets into a wedged state.
1483 Commands are normally placed in
1487 only if they produce annoying effects on the screen and are not necessary
1489 For example, the command to set the VT100 into 80-column mode
1490 would normally be part of
1492 but it causes an annoying glitch of the screen and is not normally needed
1493 since the terminal is usually already in 80-column mode.
1495 If the terminal has hardware tabs,
1496 the command to advance to the next tab stop can be given as
1502 command which moves leftward to the previous tab stop
1506 if the terminal driver modes indicate that tab stops are being expanded
1507 by the computer rather than being sent to the terminal,
1508 programs should not use
1512 even if they are present,
1513 since the user may not have the tab stops properly set.
1514 If the terminal has hardware tabs that are initially set every
1516 positions when the terminal is powered up, then the numeric parameter
1518 is given, showing the number of positions between tab stops.
1519 This is normally used by the
1521 command to determine whether to set the driver mode for hardware tab
1522 expansion, and whether to set the tab stops.
1523 If the terminal has tab stops that can be saved in nonvolatile memory, the
1525 description can assume that they are properly set.
1527 If there are commands to set and clear tab stops, they can be given as
1529 (clear all tab stops) and
1531 (set a tab stop in the current column of every row).
1532 If a more complex sequence is needed to set the tabs than can be
1533 described by this, the sequence can be placed in
1538 Certain capabilities control padding in the terminal driver.
1539 These are primarily needed by hardcopy terminals and are used by the
1541 program to set terminal driver modes appropriately.
1542 Delays embedded in the capabilities
1549 will cause the appropriate delay bits to be set in the terminal driver.
1552 (padding baud rate) is given, these values can be ignored at baud rates
1558 the delays are given as numeric capabilities
1567 If the terminal requires other than a
1569 (zero) character as a pad,
1570 this can be given as
1572 Only the first character of the
1576 If the terminal has commands to save and restore the position of the
1577 cursor, give them as
1582 If the terminal has an extra
1584 that is not normally used by
1585 software, this fact can be indicated.
1586 If the status line is viewed as an extra line below the bottom line,
1590 Special strings to go to a position in the status line and to return
1591 from the status line can be given as
1596 must leave the cursor position in the same place that it was before
1602 strings can be included in
1606 to get this effect.)
1609 takes one parameter, which is the column number of the status line
1610 to which the cursor is to be moved.
1611 If escape sequences and other special commands such as tab work while in
1612 the status line, the flag
1615 A string that turns off the status line (or otherwise erases its contents)
1618 The status line is normally assumed to be the same width as the
1619 rest of the screen, i.e.,
1621 If the status line is a different width (possibly because the terminal
1622 does not allow an entire line to be loaded), then its width in columns
1623 can be indicated with the numeric parameter
1626 If the terminal can move up or down half a line, this can be
1632 This is primarily useful for superscripts and subscripts on hardcopy
1634 If a hardcopy terminal can eject to the next page (form feed),
1640 If there is a command to repeat a given character a given number of times
1641 (to save time transmitting a large number of identical characters),
1642 this can be indicated with the parameterized string
1644 The first parameter is the character to be repeated and the second is
1645 the number of times to repeat it.
1648 feature that is unlikely to be supported by a program that uses
1651 If the terminal has a settable command character, such as the
1652 Tektronix 4025, this can be indicated with
1654 A prototype command character is chosen which is used in all capabilities.
1655 This character is given in the
1657 capability to identify it.
1658 The following convention is supported on some
1661 The environment is to be searched for a
1665 all occurrences of the prototype character are replaced by the character
1666 in the environment variable.
1669 environment variable
1670 is a very bad idea, as it conflicts with
1673 Terminal descriptions that do not represent a specific kind of known
1682 (generic) capability so that programs can complain that they do not know
1683 how to talk to the terminal.
1684 (This capability does not apply to
1686 terminal descriptions for which the escape sequences are known.)
1688 If the terminal uses xoff/xon
1689 .Pq Tn DC3 Ns / Ns Tn DC1
1690 handshaking for flow control, give
1692 Padding information should still be included so that routines can make
1693 better decisions about costs, but actual pad characters will not be
1696 If the terminal has a
1698 which acts as a shift key, setting the
1699 8th bit of any character transmitted, then this fact can be indicated with
1701 Otherwise, software will assume that the 8th bit is parity and it will
1703 If strings exist to turn this
1705 on and off, they can be given as
1710 If the terminal has more lines of memory than will fit on the screen at once,
1711 the number of lines of memory can be indicated with
1713 An explicit value of 0 indicates that the number of lines is not fixed,
1714 but that there is still more memory than fits on the screen.
1716 If the terminal is one of those supported by the
1719 terminal protocol, the terminal number can be given as
1722 Media copy strings which control an auxiliary printer
1723 connected to the terminal can be given as
1725 print the contents of the screen;
1727 turn off the printer; and
1729 turn on the printer.
1730 When the printer is on, all text sent to the terminal will be sent to the
1732 It is undefined whether the text is also displayed on the terminal screen
1733 when the printer is on.
1736 takes one parameter and leaves the printer on for as many characters as the
1737 value of the parameter, then turns the printer off.
1738 The parameter should not exceed 255.
1741 is transparently passed to the printer while
1745 Strings to program function keys can be given as
1750 Each of these strings takes two parameters: the function key number
1751 to program (from 0 to 9) and the string to program it with.
1752 Function key numbers out of this range may program undefined keys
1753 in a terminal-dependent manner.
1754 The differences among the capabilities are that
1756 causes pressing the given key to be the same as the user typing the given
1759 causes the string to be executed by the terminal in local mode;
1762 causes the string to be transmitted to the computer.
1763 Unfortunately, due to lack of a definition for string parameters in
1767 supports these capabilities.
1770 capability is automatically generated in the tgetent call and must
1774 .Ss Glitches and Braindamage
1775 Hazeltine terminals, which do not allow `~' characters to be displayed,
1781 capability, now obsolete, formerly indicated Datamedia terminals,
1785 carriage return then ignore a following linefeed.
1787 Terminals that ignore a linefeed immediately after an
1789 wrap, such as the Concept, should indicate
1794 is required to get rid of standout
1795 (instead of merely writing normal text on top of it),
1799 Teleray terminals, where tabs turn all characters moved over to blanks,
1803 This glitch is also taken to mean that it is not possible
1804 to position the cursor on top of a \*(lqmagic cookie\*(rq, and that
1805 to erase standout mode it is necessary to use delete and insert line.
1807 The Beehive Superbee, which is unable to correctly transmit the
1820 (Only certain Superbees have this problem, depending on the
1823 Other specific terminal problems may be corrected by adding more
1824 capabilities of the form
1826 .Ss Similar Terminals
1827 If there are two very similar terminals,
1828 one can be defined as being just like the other with certain exceptions.
1829 The string capability
1832 with the name of the similar terminal.
1833 This capability must be
1835 The capabilities given before
1837 override those in the terminal type invoked by
1839 A capability can be canceled by placing
1846 For example, the entry
1847 .Bd -literal -offset indent
1848 hn\||\|2621\-nl:ks@:ke@:tc=2621:
1853 that does not have the
1858 hence does not turn on the function key labels when in visual mode.
1859 This is useful for different modes for a terminal, or for different
1862 .Bl -tag -width /usr/share/misc/termcap.db -compact
1863 .It Pa /usr/share/misc/termcap
1864 File containing terminal descriptions.
1865 .It Pa /usr/share/misc/termcap.db
1866 Hash database file containing terminal descriptions (see
1879 .\" following commented since .Nx currently has no term(7)
1884 file format appeared in
1896 The transition will be relatively painless if capabilities flagged as
1900 Lines and columns are now stored by the kernel as well as in the termcap
1902 Most programs now use the kernel information primarily; the information
1903 in this file is used only if the kernel does not have any information.
1905 Not all programs support all entries.