Commit | Line | Data |
---|---|---|
c4737001 KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
f3531ae0 | 5 | .\" @(#)termcap.5 6.4 (Berkeley) %G% |
c4737001 | 6 | .\" |
ef978bfe JB |
7 | .ie n \{\ |
8 | . ds lq \&"\" | |
9 | . ds rq \&"\" | |
10 | .\} | |
11 | .el \{\ | |
12 | . ds rq '' | |
13 | . ds lq `` | |
14 | .\} | |
c4737001 | 15 | .tr || |
ef978bfe JB |
16 | .tr *\(** |
17 | .hw trans-parently | |
18 | .TH TERMCAP 5 "1 November 1985" | |
19 | .UC | |
c4737001 KM |
20 | .SH NAME |
21 | termcap \- terminal capability data base | |
22 | .SH SYNOPSIS | |
23 | /etc/termcap | |
24 | .SH DESCRIPTION | |
ef978bfe | 25 | .I Termcap\^ |
c4737001 KM |
26 | is a data base describing terminals, |
27 | used, | |
28 | .IR e.g. , | |
29 | by | |
ef978bfe | 30 | .IR vi\^ (1) |
c4737001 | 31 | and |
ef978bfe | 32 | .IR curses\^ (3X). |
c4737001 | 33 | Terminals are described in |
ef978bfe JB |
34 | .I termcap\^ |
35 | by giving a set of capabilities that they have and by describing | |
c4737001 KM |
36 | how operations are performed. |
37 | Padding requirements and initialization sequences | |
38 | are included in | |
ef978bfe | 39 | .IR termcap\^ . |
c4737001 KM |
40 | .PP |
41 | Entries in | |
ef978bfe JB |
42 | .I termcap\^ |
43 | consist of a number of `:'-separated fields. | |
44 | The first entry for each terminal gives the names that are known for the | |
45 | terminal, separated by `|' characters. | |
46 | The first name is always two characters | |
47 | long and is used by older systems which store the terminal type | |
48 | in a 16-bit word in a system-wide data base. | |
49 | The second name given is the most common abbreviation for the terminal, | |
50 | the last name given should be a long name fully identifying the terminal, | |
51 | and all others are understood as synonyms for the terminal name. | |
52 | All names but the first and last | |
53 | should be in lower case and contain no blanks; | |
54 | the last name may well contain | |
55 | upper case and blanks for readability. | |
56 | .PP | |
57 | Terminal names (except for the last, verbose entry) | |
58 | should be chosen using the following conventions. | |
59 | The particular piece of hardware making up the terminal | |
60 | should have a root name chosen, thus \*(lqhp2621\*(rq. | |
61 | This name should not contain hyphens. | |
62 | Modes that the hardware can be in | |
63 | or user preferences | |
64 | should be indicated by appending a hyphen and an indicator of the mode. | |
65 | Therefore, a \*(lqvt100\*(rq in 132-column mode would be \*(lqvt100-w\*(rq. | |
66 | The following suffixes should be used where possible: | |
67 | .sp | |
68 | .ev | |
69 | .ta | |
70 | .ta \w'\fBSuffix\fP\ \ \ 'u +\w'With automatic margins (usually default)\ \ 'u | |
71 | .nf | |
72 | .if t \{\ | |
73 | .nr Xx \n(.lu-\n(.i-\w'\fBSuffix\fP\ \ \ With automatic margins (usually default)\ \ vt100-am'u | |
74 | .in +\n(Xxu/2u | |
75 | .\} | |
76 | \fBSuffix Meaning Example\fP | |
77 | -w Wide mode (more than 80 columns) vt100-w | |
78 | -am With automatic margins (usually default) vt100-am | |
79 | -nam Without automatic margins vt100-nam | |
80 | -\fIn\fP Number of lines on the screen aaa-60 | |
81 | -na No arrow keys (leave them in local) concept100-na | |
82 | -\fIn\^\fPp Number of pages of memory concept100-4p | |
83 | -rv Reverse video concept100-rv | |
84 | .fi | |
85 | .ev | |
c4737001 | 86 | .SH CAPABILITIES |
ef978bfe JB |
87 | .PP |
88 | The characters in the | |
89 | .I Notes | |
90 | field in the table have the following meanings | |
91 | (more than one may apply to a capability): | |
92 | .PP | |
93 | .ev | |
94 | .ta | |
95 | .ta \w'N\ \ \ 'u | |
c4737001 | 96 | .nf |
ef978bfe JB |
97 | N indicates numeric parameter(s) |
98 | P indicates that padding may be specified | |
99 | * indicates that padding may be based on the number of lines affected | |
100 | o indicates capability is obsolete | |
101 | .fi | |
102 | .ev | |
103 | .PP | |
104 | \*(lqObsolete\*(rq capabilities have no | |
105 | .I terminfo\^ | |
106 | equivalents, | |
107 | since they were considered useless, | |
108 | or are subsumed by other capabilities. | |
109 | New software should not rely on them at all. | |
110 | .PP | |
111 | .nf | |
112 | .ta \w'\fBName \fP'u +\w'\fBType \fP'u +\w'\fBNotes \fP'u | |
113 | \fBName Type Notes Description\fP | |
c4737001 | 114 | ae str (P) End alternate character set |
ef978bfe | 115 | AL str (NP*) Add \fIn\^\fP new blank lines |
c4737001 KM |
116 | al str (P*) Add new blank line |
117 | am bool Terminal has automatic margins | |
118 | as str (P) Start alternate character set | |
ef978bfe JB |
119 | bc str (o) Backspace if not \fB^H\fP |
120 | bl str (P) Audible signal (bell) | |
121 | bs bool (o) Terminal can backspace with \fB^H\fP | |
c4737001 | 122 | bt str (P) Back tab |
ef978bfe JB |
123 | bw bool \fBle\fP (backspace) wraps from column 0 to last column |
124 | CC str Terminal settable command character in prototype | |
c4737001 KM |
125 | cd str (P*) Clear to end of display |
126 | ce str (P) Clear to end of line | |
ef978bfe JB |
127 | ch str (NP) Set cursor column (horizontal position) |
128 | cl str (P*) Clear screen and home cursor | |
129 | CM str (NP) Memory-relative cursor addressing | |
130 | cm str (NP) Screen-relative cursor motion | |
f3531ae0 | 131 | co num Number of columns in a line (See BUGS section below) |
ef978bfe JB |
132 | cr str (P) Carriage return |
133 | cs str (NP) Change scrolling region (VT100) | |
134 | ct str (P) Clear all tab stops | |
135 | cv str (NP) Set cursor row (vertical position) | |
136 | da bool Display may be retained above the screen | |
137 | dB num (o) Milliseconds of \fBbs\fP delay needed (default 0) | |
138 | db bool Display may be retained below the screen | |
139 | DC str (NP*) Delete \fIn\^\fP characters | |
140 | dC num (o) Milliseconds of \fBcr\fP delay needed (default 0) | |
c4737001 | 141 | dc str (P*) Delete character |
ef978bfe JB |
142 | dF num (o) Milliseconds of \fBff\fP delay needed (default 0) |
143 | DL str (NP*) Delete \fIn\^\fP lines | |
c4737001 | 144 | dl str (P*) Delete line |
ef978bfe JB |
145 | dm str Enter delete mode |
146 | dN num (o) Milliseconds of \fBnl\fP delay needed (default 0) | |
147 | DO str (NP*) Move cursor down \fIn\^\fP lines | |
c4737001 | 148 | do str Down one line |
ef978bfe JB |
149 | ds str Disable status line |
150 | dT num (o) Milliseconds of horizontal tab delay needed (default 0) | |
151 | dV num (o) Milliseconds of vertical tab delay needed (default 0) | |
152 | ec str (NP) Erase \fIn\^\fP characters | |
c4737001 | 153 | ed str End delete mode |
ef978bfe JB |
154 | ei str End insert mode |
155 | eo bool Can erase overstrikes with a blank | |
156 | EP bool (o) Even parity | |
157 | es bool Escape can be used on the status line | |
158 | ff str (P*) Hardcopy terminal page eject | |
159 | fs str Return from status line | |
160 | gn bool Generic line type (\fIe.g.\fP dialup, switch) | |
c4737001 | 161 | hc bool Hardcopy terminal |
ef978bfe | 162 | HD bool (o) Half-duplex |
c4737001 | 163 | hd str Half-line down (forward 1/2 linefeed) |
ef978bfe JB |
164 | ho str (P) Home cursor |
165 | hs bool Has extra \*(lqstatus line\*(rq | |
c4737001 | 166 | hu str Half-line up (reverse 1/2 linefeed) |
ef978bfe JB |
167 | hz bool Cannot print ~s (Hazeltine) |
168 | i1-i3 str Terminal initialization strings (\fIterminfo\^\fP only) | |
169 | IC str (NP*) Insert \fIn\^\fP blank characters | |
170 | ic str (P*) Insert character | |
171 | if str Name of file containing initialization string | |
172 | im str Enter insert mode | |
173 | in bool Insert mode distinguishes nulls | |
174 | iP str Pathname of program for initialization (\fIterminfo\^\fP only) | |
c4737001 | 175 | ip str (P*) Insert pad after character inserted |
ef978bfe JB |
176 | is str Terminal initialization string (\fItermcap\^\fP only) |
177 | it num Tabs initially every \fIn\^\fP positions | |
178 | K1 str Sent by keypad upper left | |
179 | K2 str Sent by keypad upper right | |
180 | K3 str Sent by keypad center | |
181 | K4 str Sent by keypad lower left | |
182 | K5 str Sent by keypad lower right | |
183 | k0-k9 str Sent by function keys 0-9 | |
184 | kA str Sent by insert-line key | |
185 | ka str Sent by clear-all-tabs key | |
c4737001 | 186 | kb str Sent by backspace key |
ef978bfe JB |
187 | kC str Sent by clear-screen or erase key |
188 | kD str Sent by delete-character key | |
189 | kd str Sent by down-arrow key | |
190 | kE str Sent by clear-to-end-of-line key | |
c4737001 | 191 | ke str Out of \*(lqkeypad transmit\*(rq mode |
ef978bfe JB |
192 | kF str Sent by scroll-forward/down key |
193 | kH str Sent by home-down key | |
c4737001 | 194 | kh str Sent by home key |
ef978bfe JB |
195 | kI str Sent by insert-character or enter-insert-mode key |
196 | kL str Sent by delete-line key | |
197 | kl str Sent by left-arrow key | |
198 | kM str Sent by insert key while in insert mode | |
199 | km bool Has a \*(lqmeta\*(rq key (shift, sets parity bit) | |
200 | kN str Sent by next-page key | |
201 | kn num (o) Number of function (\fBk0\fP\-\fBk9\fP) keys (default 0) | |
202 | ko str (o) Termcap entries for other non-function keys | |
203 | kP str Sent by previous-page key | |
204 | kR str Sent by scroll-backward/up key | |
205 | kr str Sent by right-arrow key | |
206 | kS str Sent by clear-to-end-of-screen key | |
c4737001 | 207 | ks str Put terminal in \*(lqkeypad transmit\*(rq mode |
ef978bfe JB |
208 | kT str Sent by set-tab key |
209 | kt str Sent by clear-tab key | |
210 | ku str Sent by up-arrow key | |
211 | l0-l9 str Labels on function keys if not \*(lqf\fIn\^\fP\*(rq | |
212 | LC bool (o) Lower-case only | |
213 | LE str (NP) Move cursor left \fIn\^\fP positions | |
214 | le str (P) Move cursor left one position | |
f3531ae0 | 215 | li num Number of lines on screen or page (See BUGS section below) |
c007a4d8 | 216 | ll str Last line, first column |
ef978bfe JB |
217 | lm num Lines of memory if > \fBli\fP (0 means varies) |
218 | ma str (o) Arrow key map (used by \fIvi\^\fP version 2 only) | |
219 | mb str Turn on blinking attribute | |
220 | md str Turn on bold (extra bright) attribute | |
221 | me str Turn off all attributes | |
222 | mh str Turn on half-bright attribute | |
c4737001 | 223 | mi bool Safe to move while in insert mode |
ef978bfe JB |
224 | mk str Turn on blank attribute (characters invisible) |
225 | ml str (o) Memory lock on above cursor | |
226 | mm str Turn on \*(lqmeta mode\*(rq (8th bit) | |
227 | mo str Turn off \*(lqmeta mode\*(rq | |
228 | mp str Turn on protected attribute | |
229 | mr str Turn on reverse-video attibute | |
230 | ms bool Safe to move in standout modes | |
231 | mu str (o) Memory unlock (turn off memory lock) | |
232 | nc bool (o) No correctly-working \fBcr\fP (Datamedia 2500, Hazeltine 2000) | |
c4737001 | 233 | nd str Non-destructive space (cursor right) |
ef978bfe JB |
234 | NL bool (o) \fB\\n\fP is newline, not line feed |
235 | nl str (o) Newline character if not \fB\\n\fP | |
236 | ns bool (o) Terminal is a \s-1CRT\s0 but doesn't scroll | |
237 | nw str (P) Newline (behaves like \fBcr\fP followed by \fBdo\fP) | |
238 | OP bool (o) Odd parity | |
c4737001 | 239 | os bool Terminal overstrikes |
ef978bfe JB |
240 | pb num Lowest baud where delays are required |
241 | pc str Pad character (default \s-2NUL\s0) | |
242 | pf str Turn off the printer | |
243 | pk str Program function key \fIn\^\fP to type string \fIs\fP (\fIterminfo\^\fP only) | |
244 | pl str Program function key \fIn\^\fP to execute string \fIs\fP (\fIterminfo\^\fP only) | |
245 | pO str (N) Turn on the printer for \fIn\^\fP bytes | |
246 | po str Turn on the printer | |
247 | ps str Print contents of the screen | |
248 | pt bool (o) Has hardware tabs (may need to be set with \fBis\fP) | |
249 | px str Program function key \fIn\^\fP to transmit string \fIs\fP (\fIterminfo\^\fP only) | |
250 | r1-r3 str Reset terminal completely to sane modes (\fIterminfo\^\fP only) | |
251 | rc str (P) Restore cursor to position of last \fBsc\fP | |
252 | rf str Name of file containing reset codes | |
253 | RI str (NP) Move cursor right \fIn\^\fP positions | |
254 | rp str (NP*) Repeat character \fIc n\^\fP times | |
255 | rs str Reset terminal completely to sane modes (\fItermcap\^\fP only) | |
256 | sa str (NP) Define the video attributes | |
257 | sc str (P) Save cursor position | |
258 | se str End standout mode | |
259 | SF str (NP*) Scroll forward \fIn\^\fP lines | |
260 | sf str (P) Scroll text up | |
261 | sg num Number of garbage chars left by \fBso\fP or \fBse\fP (default 0) | |
262 | so str Begin standout mode | |
263 | SR str (NP*) Scroll backward \fIn\^\fP lines | |
264 | sr str (P) Scroll text down | |
265 | st str Set a tab in all rows, current column | |
266 | ta str (P) Tab to next 8-position hardware tab stop | |
267 | tc str Entry of similar terminal \- must be last | |
268 | te str String to end programs that use \fItermcap\fP | |
269 | ti str String to begin programs that use \fItermcap\fP | |
270 | ts str (N) Go to status line, column \fIn\^\fP | |
271 | UC bool (o) Upper-case only | |
272 | uc str Underscore one character and move past it | |
c4737001 | 273 | ue str End underscore mode |
ef978bfe JB |
274 | ug num Number of garbage chars left by \fBus\fP or \fBue\fP (default 0) |
275 | ul bool Underline character overstrikes | |
276 | UP str (NP*) Move cursor up \fIn\^\fP lines | |
c4737001 KM |
277 | up str Upline (cursor up) |
278 | us str Start underscore mode | |
ef978bfe JB |
279 | vb str Visible bell (must not move cursor) |
280 | ve str Make cursor appear normal (undo \fBvs\fP/\fBvi\fP) | |
281 | vi str Make cursor invisible | |
282 | vs str Make cursor very visible | |
283 | vt num Virtual terminal number (not supported on all systems) | |
284 | wi str (N) Set current window | |
285 | ws num Number of columns in status line | |
286 | xb bool Beehive (f1=\s-2ESC\s0, f2=^C) | |
287 | xn bool Newline ignored after 80 cols (Concept) | |
288 | xo bool Terminal uses xoff/xon (\s-2DC3\s0/\s-2DC1\s0) handshaking | |
289 | xr bool (o) Return acts like \fBce cr nl\fP (Delta Data) | |
290 | xs bool Standout not erased by overwriting (Hewlett-Packard) | |
291 | xt bool Tabs ruin, magic \fBso\fP char (Teleray 1061) | |
292 | xx bool (o) Tektronix 4025 insert-line | |
c4737001 | 293 | .fi |
ef978bfe | 294 | .ta 8n +8n |
c4737001 KM |
295 | .PP |
296 | .B A Sample Entry | |
297 | .PP | |
298 | The following entry, which describes the Concept\-100, is among the more | |
299 | complex entries in the | |
ef978bfe | 300 | .I termcap\^ |
c4737001 | 301 | file as of this writing. |
c4737001 KM |
302 | .PP |
303 | .nf | |
ef978bfe JB |
304 | ca\||\|concept100\||\|c100\||\|concept\||\|c104\||\|concept100-4p\||\|HDS Concept\-100:\e |
305 | :al=3*\eE^R:am:bl=^G:cd=16*\eE^C:ce=16\eE^U:cl=2*^L:cm=\eEa%+ %+ :\e | |
306 | :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 | |
307 | :ip=16*:is=\eEU\eEf\eE7\eE5\eE8\eEl\eENH\eEK\eE\e200\eEo&\e200\eEo\e47\eE:k1=\eE5:\e | |
308 | :k2=\eE6:k3=\eE7:kb=^h:kd=\eE<:ke=\eEx:kh=\eE?:kl=\eE>:kr=\eE=:ks=\eEX:\e | |
309 | :ku=\eE;:le=^H:li#24:mb=\eEC:me=\eEN\e200:mh=\eEE:mi:mk=\eEH:mp=\eEI:\e | |
310 | :mr=\eED:nd=\eE=:pb#9600:rp=0.2*\eEr%.%+ :se=\eEd\eEe:sf=^J:so=\eEE\eED:\e | |
311 | :.ta=8\et:te=\eEv \e200\e200\e200\e200\e200\e200\eEp\er\en:\e | |
312 | :ti=\eEU\eEv 8p\eEp\er:ue=\eEg:ul:up=\eE;:us=\eEG:\e | |
313 | :vb=\eEk\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\eEK:\e | |
314 | :ve=\eEw:vs=\eEW:vt#8:xn:\e | |
315 | :bs:cr=^M:dC#9:dT#8:nl=^J:ta=^I:pt: | |
c4737001 KM |
316 | .fi |
317 | .PP | |
318 | Entries may continue onto multiple lines by giving a \e as the last | |
ef978bfe | 319 | character of a line, and empty fields |
c4737001 KM |
320 | may be included for readability (here between the last field on a line |
321 | and the first field on the next). | |
ef978bfe JB |
322 | Comments may be included on lines beginning with \*(lq#\*(rq. |
323 | .br | |
324 | .ne 5 | |
c4737001 KM |
325 | .PP |
326 | .B Types of Capabilities | |
327 | .PP | |
ef978bfe JB |
328 | Capabilities in |
329 | .I termcap\^ | |
330 | are of three types: Boolean capabilities, | |
331 | which indicate particular features that the terminal has; | |
332 | numeric capabilities, | |
333 | giving the size of the display or the size of other attributes; | |
334 | and string capabilities, | |
335 | which give character sequences that can be used to perform particular | |
336 | terminal operations. | |
337 | All capabilities have two-letter codes. | |
338 | For instance, the fact that | |
339 | the Concept has | |
340 | .I automatic margins | |
341 | .RI ( i.e. , | |
342 | an automatic return and linefeed | |
343 | when the end of a line is reached) is indicated by the Boolean capability | |
344 | .BR am . | |
345 | Hence the description of the Concept includes | |
346 | .BR am . | |
347 | .PP | |
348 | Numeric capabilities are followed by the character `#' then the value. | |
349 | In the example above | |
350 | .BR co , | |
351 | which indicates the number of columns the display has, | |
c4737001 KM |
352 | gives the value `80' for the Concept. |
353 | .PP | |
ef978bfe JB |
354 | Finally, string-valued capabilities, such as |
355 | .B ce | |
356 | (clear-to-end-of-line | |
357 | sequence) are given by the two-letter code, an `=', then a string | |
358 | ending at the next following `:'. | |
359 | A delay in milliseconds may appear after | |
360 | the `=' in such a capability, | |
361 | which causes padding characters to be supplied by | |
362 | .I tputs\^ | |
363 | after the remainder of the string is sent to provide this delay. | |
364 | The delay can be either a number, | |
365 | .I e.g. | |
366 | `20', or a number followed by | |
367 | an `*', | |
368 | .IR i.e. , | |
369 | `3*'. | |
370 | An `*' indicates that the padding required is proportional | |
c4737001 | 371 | to the number of lines affected by the operation, and the amount given is |
ef978bfe JB |
372 | the per-affected-line padding required. |
373 | (In the case of insert-character, | |
374 | the factor is still the number of | |
375 | .I lines\^ | |
376 | affected; | |
377 | this is always 1 unless the terminal has | |
378 | .B in | |
379 | and the software uses it.) | |
380 | When an `*' is specified, it is sometimes useful to give a delay of the form | |
381 | `3.5' to specify a delay per line to tenths of milliseconds. | |
382 | (Only one decimal place is allowed.) | |
383 | .PP | |
384 | A number of escape sequences are provided in the string-valued capabilities | |
385 | for easy encoding of control characters there. | |
386 | .B \eE | |
387 | maps to an \s-2ESC\s0 | |
388 | character, | |
389 | .B ^X | |
390 | maps to a control-X for any appropriate X, | |
391 | and the sequences | |
392 | .B \en | |
393 | .B \er | |
394 | .B \et | |
395 | .B \eb | |
396 | .B \ef | |
397 | map to linefeed, return, tab, backspace, and formfeed, respectively. | |
398 | Finally, characters may be given as three octal digits after a | |
399 | .BR \e , | |
400 | and the characters | |
401 | .B ^ | |
402 | and | |
403 | .B \e | |
404 | may be given as | |
405 | .B \e^ | |
406 | and | |
407 | .BR \e\e . | |
408 | If it is necessary to place a | |
409 | .B : | |
410 | in a capability it must be escaped in | |
411 | octal as | |
412 | .BR \e072 . | |
413 | If it is necessary to place a \s-2NUL\s0 | |
414 | character in a string capability it | |
415 | must be encoded as | |
416 | .BR \e200 . | |
417 | (The routines that deal with | |
418 | .I termcap\^ | |
419 | use C strings and strip the high bits of the output very late, so that | |
420 | a | |
421 | .B \e200 | |
422 | comes out as a | |
423 | .B \e000 | |
424 | would.) | |
425 | .PP | |
426 | Sometimes individual capabilities must be commented out. | |
427 | To do this, put a period before the capability name. | |
428 | For example, see the first | |
429 | .B cr | |
430 | and | |
431 | .B ta | |
432 | in the example above. | |
c4737001 KM |
433 | .br |
434 | .ne 5 | |
435 | .PP | |
436 | .B Preparing Descriptions | |
437 | .PP | |
438 | We now outline how to prepare descriptions of terminals. | |
439 | The most effective way to prepare a terminal description is by imitating | |
440 | the description of a similar terminal in | |
ef978bfe | 441 | .I termcap\^ |
c4737001 KM |
442 | and to build up a description gradually, using partial descriptions |
443 | with | |
ef978bfe | 444 | .I vi\^ |
c4737001 KM |
445 | to check that they are correct. |
446 | Be aware that a very unusual terminal may expose deficiencies in | |
447 | the ability of the | |
ef978bfe | 448 | .I termcap\^ |
c4737001 KM |
449 | file to describe it |
450 | or bugs in | |
ef978bfe | 451 | .IR vi\^ . |
c4737001 | 452 | To easily test a new terminal description you can set the environment variable |
ef978bfe JB |
453 | .B |
454 | .SM TERMCAP | |
455 | to the absolute pathname of a file containing the description you are working | |
456 | on and programs will look there rather than in | |
457 | .IR /etc/termcap\^ . | |
458 | .B | |
459 | .SM TERMCAP | |
460 | can also be set to the | |
461 | .I termcap\^ | |
462 | entry itself | |
463 | to avoid reading the file when starting up a program. | |
464 | .PP | |
465 | To get the padding for insert-line right | |
466 | (if the terminal manufacturer did not document it), | |
467 | a severe test is to use | |
468 | .I vi\^ | |
469 | to edit | |
470 | .I /etc/passwd\^ | |
471 | at 9600 baud, delete roughly 16 lines from the middle of the screen, | |
472 | then hit the `u' key several times quickly. | |
473 | If the display messes up, more padding is usually needed. | |
474 | A similar test can be used for insert-character. | |
475 | .br | |
476 | .ne 5 | |
477 | .PP | |
478 | .B Basic Capabilities | |
479 | .PP | |
480 | The number of columns on each line of the display is given by the | |
481 | .B co | |
482 | numeric capability. | |
483 | If the display is a \s-1CRT\s0, then the | |
484 | number of lines on the screen is given by the | |
485 | .B li | |
486 | capability. | |
487 | If the display wraps around to the beginning of the next line when | |
488 | the cursor reaches the right margin, then it should have the | |
489 | .B am | |
490 | capability. | |
491 | If the terminal can clear its screen, | |
492 | the code to do this is given by the | |
493 | .B cl | |
494 | string capability. | |
495 | If the terminal overstrikes | |
496 | (rather than clearing the position when a character is overwritten), | |
497 | it should have the | |
498 | .B os | |
499 | capability. | |
500 | If the terminal is a printing terminal, | |
501 | with no soft copy unit, | |
502 | give it both | |
503 | .B hc | |
504 | and | |
505 | .BR os . | |
506 | .RB ( os | |
507 | applies to storage scope terminals, | |
508 | such as the Tektronix 4010 series, | |
509 | as well as to hard copy and | |
510 | .SM APL | |
511 | terminals.) | |
512 | If there is a code to move the cursor to the left edge of the current row, | |
513 | give this as | |
514 | .BR cr . | |
515 | (Normally this will be carriage-return, | |
516 | .BR ^M .) | |
517 | If there is a code to produce an audible signal (bell, beep, | |
518 | .IR etc.\^ ), | |
519 | give this as | |
520 | .BR bl . | |
521 | .PP | |
522 | If there is a code (such as backspace) | |
523 | to move the cursor one position to the left, | |
524 | that capability should be given as | |
525 | .BR le . | |
526 | Similarly, | |
527 | codes to move to the right, up, and down | |
528 | should be given as | |
529 | .BR nd , | |
530 | .BR up , | |
531 | and | |
532 | .BR do , | |
533 | respectively. | |
534 | These | |
535 | .I local cursor motions\^ | |
536 | should not alter the text they pass over; | |
537 | for example, you would not normally use | |
538 | \*(lqnd=\ \*(rq | |
539 | unless the terminal has the | |
540 | .B os | |
541 | capability, | |
542 | because the space would erase the character moved over. | |
c4737001 KM |
543 | .PP |
544 | A very important point here is that the local cursor motions encoded | |
545 | in | |
ef978bfe JB |
546 | .I termcap\^ |
547 | have undefined behavior at the left and top edges of a | |
548 | .SM CRT | |
549 | display. | |
550 | Programs should never attempt to backspace around the left edge, | |
551 | unless | |
552 | .B bw | |
553 | is given, and never attempt to go up off the top | |
554 | using local cursor motions. | |
555 | .PP | |
556 | In order to scroll text up, | |
557 | a program goes to the bottom left corner of the screen and sends the | |
558 | .B sf | |
559 | (index) string. | |
560 | To scroll text down, | |
561 | a program goes to the top left corner of the screen and sends the | |
562 | .B sr | |
563 | (reverse index) string. | |
564 | The strings | |
565 | .B sf | |
566 | and | |
567 | .B sr | |
568 | have undefined behavior | |
569 | when not on their respective corners of the screen. | |
570 | Parameterized versions of the scrolling sequences are | |
571 | .B SF | |
572 | and | |
573 | .BR SR , | |
574 | which have the same semantics as | |
575 | .B sf | |
576 | and | |
577 | .B sr | |
578 | except that they take one parameter | |
579 | and scroll that many lines. | |
580 | They also have undefined behavior | |
581 | except at the appropriate corner of the screen. | |
582 | .PP | |
583 | The | |
584 | .B am | |
585 | capability tells whether the cursor sticks at the right | |
586 | edge of the screen when text is output there, | |
587 | but this does not necessarily apply to | |
588 | .B nd | |
589 | from the last column. | |
590 | Leftward local motion is defined from the left edge only when | |
591 | .B bw | |
592 | is given; then an | |
593 | .B le | |
594 | from the left edge will move to the right edge of the previous row. | |
595 | This is useful for drawing a box around the edge of the screen, | |
596 | for example. | |
597 | If the terminal has switch-selectable automatic margins, | |
c4737001 | 598 | the |
ef978bfe JB |
599 | .I termcap\^ |
600 | description usually assumes that this feature is on, | |
601 | .IR i.e. , | |
602 | .BR am . | |
603 | If the terminal has a command | |
604 | that moves to the first column of the next line, | |
605 | that command can be given as | |
606 | .B nw | |
607 | (newline). | |
608 | It is permissible for this to clear the remainder of the current line, | |
609 | so if the terminal has no correctly-working \s-2CR\s0 and \s-2LF\s0 | |
610 | it may still be possible to craft a working | |
611 | .B nw | |
612 | out of one or both of them. | |
c4737001 KM |
613 | .PP |
614 | These capabilities suffice to describe hardcopy and \*(lqglass-tty\*(rq terminals. | |
ef978bfe | 615 | Thus the Teletype model 33 is described as |
c4737001 | 616 | .PP |
ef978bfe JB |
617 | .nf |
618 | T3\||\|tty33\||\|33\||\|tty\||\|Teletype model 33:\e | |
619 | :bl=^G:co#72:cr=^M:do=^J:hc:os: | |
620 | .fi | |
c4737001 | 621 | .PP |
ef978bfe | 622 | and the Lear Siegler \s-1ADM\s0\-3 is described as |
c4737001 | 623 | .PP |
ef978bfe JB |
624 | .nf |
625 | l3\||\|adm3\||\|3\||\|LSI \s-1ADM\s0-3:\e | |
626 | :am:bl=^G:cl=^Z:co#80:cr=^M:do=^J:le=^H:li#24:sf=^J: | |
627 | .fi | |
628 | .br | |
629 | .ne 5 | |
c4737001 | 630 | .PP |
ef978bfe | 631 | .B Parameterized Strings |
c4737001 | 632 | .PP |
ef978bfe JB |
633 | Cursor addressing and other strings requiring parameters |
634 | are described by a | |
635 | parameterized string capability, with | |
636 | .IR printf\^ (3S)-like | |
637 | escapes | |
638 | .B %x | |
639 | in it, | |
c4737001 | 640 | while other characters are passed through unchanged. |
ef978bfe JB |
641 | For example, to address the cursor the |
642 | .B cm | |
643 | capability is given, using two parameters: the row and column to move to. | |
644 | (Rows and columns are numbered from zero and refer to the physical screen | |
645 | visible to the user, not to any unseen memory. | |
646 | If the terminal has memory-relative cursor addressing, | |
647 | that can be indicated by an analogous | |
648 | .B CM | |
649 | capability.) | |
650 | .PP | |
651 | The | |
652 | .B % | |
653 | encodings have the following meanings: | |
c4737001 KM |
654 | .PP |
655 | .DT | |
656 | .nf | |
ef978bfe JB |
657 | %% output `%' |
658 | %d output value as in \fIprintf\^\fP %d | |
659 | %2 output value as in \fIprintf\^\fP %2d | |
660 | %3 output value as in \fIprintf\^\fP %3d | |
661 | %. output value as in \fIprintf\^\fP %c | |
662 | %+\fIx\fP add \fIx\^\fP to value, then do %. | |
663 | %>\fIxy\fP if value > \fIx\^\fP then add \fIy\^\fP, no output | |
664 | %r reverse order of two parameters, no output | |
665 | %i increment by one, no output | |
666 | %n exclusive-or all parameters with 0140 (Datamedia 2500) | |
667 | %B BCD (16*(value/10)) + (value%10), no output | |
668 | %D Reverse coding (value \- 2*(value%16)), no output (Delta Data) | |
c4737001 KM |
669 | .fi |
670 | .PP | |
ef978bfe JB |
671 | Consider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needs |
672 | to be sent \*(lq\eE&a12c03Y\*(rq padded for 6 milliseconds. | |
673 | Note that the order | |
674 | of the row and column coordinates is reversed here | |
675 | and that the row and column | |
676 | are sent as two-digit integers. | |
677 | Thus its | |
678 | .B cm | |
679 | capability is \*(lqcm=6\eE&%r%2c%2Y\*(rq. | |
680 | .PP | |
681 | The Microterm | |
682 | .SM ACT-IV | |
683 | needs the current row and column sent | |
684 | simply encoded in binary | |
685 | preceded by a | |
686 | .BR ^T , | |
687 | \*(lqcm=^T%.%.\*(rq. | |
688 | Terminals that use \*(lq%.\*(rq need to be able to | |
689 | backspace the cursor | |
690 | .RB ( le ) | |
691 | and to move the cursor up one line on the screen | |
692 | .RB ( up ). | |
693 | This is necessary because it is not always safe to transmit | |
694 | .BR \en , | |
695 | .BR ^D , | |
696 | and | |
697 | .BR \er , | |
698 | as the system may change or discard them. | |
699 | (Programs using | |
700 | .I termcap\^ | |
701 | must set terminal modes so that tabs are not expanded, so | |
702 | .B \et | |
703 | is safe to send. | |
704 | This turns out to be essential for the Ann Arbor 4080.) | |
705 | .PP | |
706 | A final example is the Lear Siegler \s-1ADM\s0\-3a, | |
707 | which offsets row and column | |
708 | by a blank character, thus \*(lqcm=\eE=%+ %+ \*(rq. | |
709 | .PP | |
710 | Row or column absolute cursor addressing | |
711 | can be given as single parameter capabilities | |
712 | .B ch | |
713 | (horizontal position absolute) and | |
714 | .B cv | |
715 | (vertical position absolute). | |
716 | Sometimes these are shorter than the more general two-parameter sequence | |
717 | (as with the Hewlett-Packard 2645) and can be used in preference to | |
718 | .BR cm . | |
719 | If there are parameterized local motions | |
720 | .RI ( e.g. , | |
721 | move | |
722 | .I n\^ | |
723 | positions to the right) | |
724 | these can be given as | |
725 | .BR DO , | |
726 | .BR LE , | |
727 | .BR RI , | |
728 | and | |
729 | .B UP | |
730 | with a single parameter indicating how many positions to move. | |
731 | These are primarily useful if the terminal does not have | |
732 | .BR cm , | |
733 | such as the Tektronix 4025. | |
734 | .br | |
735 | .ne 5 | |
736 | .PP | |
737 | .B Cursor Motions | |
738 | .PP | |
739 | If the terminal has a fast way to home the cursor | |
740 | (to the very upper left corner of the screen), this can be given as | |
741 | .BR ho . | |
742 | Similarly, a fast way of getting to the lower left-hand corner | |
743 | can be given as | |
744 | .BR ll ; | |
745 | this may involve going up with | |
746 | .B up | |
c4737001 | 747 | from the home position, |
ef978bfe JB |
748 | but a program should never do this itself (unless |
749 | .B ll | |
750 | does), because it can | |
751 | make no assumption about the effect of moving up from the home position. | |
752 | Note that the home position is the same as | |
753 | cursor address (0,0): to the top left corner of the screen, not of memory. | |
754 | (Therefore, the \*(lq\eEH\*(rq sequence on Hewlett-Packard terminals | |
755 | cannot be used for | |
756 | .BR ho .) | |
757 | .br | |
758 | .ne 5 | |
c4737001 | 759 | .PP |
ef978bfe | 760 | .B Area Clears |
c4737001 KM |
761 | .PP |
762 | If the terminal can clear from the current position to the end of the | |
ef978bfe JB |
763 | line, leaving the cursor where it is, this should be given as |
764 | .BR ce . | |
c4737001 | 765 | If the terminal can clear from the current position to the end of the |
ef978bfe JB |
766 | display, this should be given as |
767 | .BR cd . | |
768 | .B cd | |
769 | must only be invoked from the first column of a line. | |
770 | (Therefore, | |
771 | it can be simulated by a request to delete a large number of lines, | |
772 | if a true | |
773 | .B cd | |
774 | is not available.) | |
775 | .br | |
776 | .ne 5 | |
c4737001 | 777 | .PP |
ef978bfe | 778 | .B Insert/Delete Line |
c4737001 | 779 | .PP |
ef978bfe JB |
780 | If the terminal can open a new blank line |
781 | before the line containing the cursor, | |
782 | this should be given as | |
783 | .BR al ; | |
784 | this must be invoked only from the first | |
785 | position of a line. | |
786 | The cursor must then appear at the left of the newly blank line. | |
787 | If the terminal can delete the line that the cursor is on, this | |
788 | should be given as | |
789 | .BR dl ; | |
790 | this must only be used from the first position on | |
c4737001 | 791 | the line to be deleted. |
ef978bfe JB |
792 | Versions of |
793 | .B al | |
794 | and | |
795 | .B dl | |
796 | which take a single parameter | |
797 | and insert or delete that many lines | |
798 | can be given as | |
799 | .B AL | |
800 | and | |
801 | .BR DL . | |
802 | If the terminal has a settable scrolling region | |
803 | (like the VT100), | |
804 | the command to set this can be described with the | |
805 | .B cs | |
806 | capability, | |
807 | which takes two parameters: the top and bottom lines of the scrolling region. | |
808 | The cursor position is, alas, undefined after using this command. | |
809 | It is possible to get the effect of insert or delete line | |
810 | using this command \(em the | |
811 | .B sc | |
812 | and | |
813 | .B rc | |
814 | (save and restore cursor) commands are also useful. | |
815 | Inserting lines at the top or bottom of the screen can also be done using | |
816 | .B sr | |
817 | or | |
818 | .B sf | |
819 | on many terminals without a true insert/delete line, | |
820 | and is often faster even on terminals with those features. | |
821 | .PP | |
822 | If the terminal has the ability to define a window as part of memory | |
823 | which all commands affect, it should be given as the parameterized string | |
824 | .BR wi . | |
825 | The four parameters are the starting and ending lines in memory | |
826 | and the starting and ending columns in memory, in that order. | |
827 | (This | |
828 | .I terminfo\^ | |
829 | capability is described for completeness. | |
830 | It is unlikely that any | |
831 | .IR termcap\^ -using | |
832 | program will support it.) | |
833 | .PP | |
834 | If the terminal can retain display memory above the screen, then the | |
835 | .B da | |
836 | capability should be given; | |
837 | if display memory can be retained | |
838 | below, then | |
839 | .B db | |
840 | should be given. | |
841 | These indicate | |
842 | that deleting a line or scrolling may bring non-blank lines up from below | |
843 | or that scrolling back with | |
844 | .B sr | |
845 | may bring down non-blank lines. | |
846 | .br | |
847 | .ne 5 | |
c4737001 | 848 | .PP |
ef978bfe | 849 | .B Insert/Delete Character |
c4737001 KM |
850 | .PP |
851 | There are two basic kinds of intelligent terminals with respect to | |
ef978bfe JB |
852 | insert/delete character that can be described using |
853 | .IR termcap\^ . | |
c4737001 KM |
854 | The most common insert/delete character operations affect only the characters |
855 | on the current line and shift characters off the end of the line rigidly. | |
ef978bfe | 856 | Other terminals, such as the Concept\-100 and the Perkin Elmer Owl, make |
c4737001 KM |
857 | a distinction between typed and untyped blanks on the screen, shifting |
858 | upon an insert or delete only to an untyped blank on the screen which is | |
ef978bfe JB |
859 | either eliminated or expanded to two untyped blanks. |
860 | You can determine | |
861 | the kind of terminal you have by clearing the screen then typing | |
862 | text separated by cursor motions. | |
863 | Type \*(lqabc\ \ \ \ def\*(rq using local | |
c4737001 KM |
864 | cursor motions (not spaces) between the \*(lqabc\*(rq and the \*(lqdef\*(rq. |
865 | Then position the cursor before the \*(lqabc\*(rq and put the terminal in insert | |
ef978bfe JB |
866 | mode. |
867 | If typing characters causes the rest of the line to shift | |
c4737001 | 868 | rigidly and characters to fall off the end, then your terminal does |
ef978bfe JB |
869 | not distinguish between blanks and untyped positions. |
870 | If the \*(lqabc\*(rq | |
c4737001 | 871 | shifts over to the \*(lqdef\*(rq which then move together around the end of the |
ef978bfe JB |
872 | current line and onto the next as you insert, then you have the second type of |
873 | terminal and should give the capability \fBin\fP, which stands for | |
874 | \*(lqinsert null\*(rq. | |
875 | While these are two logically separate attributes | |
876 | (one line | |
877 | .I vs. | |
878 | multi-line insert mode, | |
879 | and special treatment of untyped spaces), | |
880 | we have seen no terminals whose insert | |
881 | mode cannot be described with the single attribute. | |
882 | .PP | |
883 | .I Termcap\^ | |
884 | can describe both terminals that have an insert mode and terminals | |
885 | that send a simple sequence to open a blank position on the current line. | |
886 | Give as | |
887 | .B im | |
888 | the sequence to get into insert mode. | |
889 | Give as | |
890 | .B ei | |
891 | the sequence to leave insert mode. | |
892 | Now give as | |
893 | .B ic | |
894 | any sequence that needs to be sent just before | |
895 | each character to be inserted. | |
896 | Most terminals with a true insert mode | |
897 | will not give | |
898 | .BR ic ; | |
899 | terminals that use a sequence to open a screen | |
900 | position should give it here. | |
901 | (If your terminal has both, | |
902 | insert mode is usually preferable to | |
903 | .BR ic . | |
904 | Do not give both unless the terminal actually requires both to be used | |
905 | in combination.) | |
906 | If post-insert padding is needed, give this as a number of milliseconds | |
907 | in | |
908 | .B ip | |
909 | (a string option). | |
910 | Any other sequence that may need to be | |
911 | sent after insertion of a single character can also be given in | |
912 | .BR ip . | |
913 | If your terminal needs to be placed into an `insert mode' | |
914 | and needs a special code preceding each inserted character, | |
915 | then both | |
916 | .BR im / ei | |
917 | and | |
918 | .B ic | |
919 | can be given, and both will be used. | |
920 | The | |
921 | .B IC | |
922 | capability, with one parameter | |
923 | .IR n\^ , | |
924 | will repeat the effects of | |
925 | .B ic | |
926 | .I n\^ | |
927 | times. | |
c4737001 KM |
928 | .PP |
929 | It is occasionally necessary to move around while in insert mode | |
ef978bfe JB |
930 | to delete characters on the same line |
931 | .RI ( e.g. , | |
932 | if there is a tab after | |
933 | the insertion position). | |
934 | If your terminal allows motion while in | |
935 | insert mode, you can give the capability | |
936 | .B mi | |
937 | to speed up inserting | |
938 | in this case. | |
939 | Omitting | |
940 | .B mi | |
941 | will affect only speed. | |
942 | Some terminals | |
943 | (notably Datamedia's) must not have | |
944 | .B mi | |
945 | because of the way their | |
c4737001 KM |
946 | insert mode works. |
947 | .PP | |
ef978bfe JB |
948 | Finally, you can specify |
949 | .B dc | |
950 | to delete a single character, | |
951 | .B DC | |
952 | with one parameter | |
953 | .I n\^ | |
954 | to delete | |
955 | .I n\^ | |
956 | characters, | |
957 | and delete mode by giving | |
958 | .B dm | |
959 | and | |
960 | .B ed | |
961 | to enter and exit delete mode | |
962 | (which is any mode the terminal needs to be placed in for | |
963 | .B dc | |
964 | to work). | |
965 | .br | |
966 | .ne 5 | |
c4737001 | 967 | .PP |
ef978bfe | 968 | .B Highlighting, Underlining, and Visible Bells |
c4737001 | 969 | .PP |
ef978bfe JB |
970 | If your terminal has one or more kinds of display attributes, |
971 | these can be represented in a number of different ways. | |
972 | You should choose one display form as | |
973 | .IR "standout mode" , | |
974 | representing a good high-contrast, easy-on-the-eyes format | |
975 | for highlighting error messages and other attention getters. | |
976 | (If you have a choice, reverse video plus half-bright is good, | |
977 | or reverse video alone.) | |
978 | The sequences to enter and exit standout mode | |
979 | are given as | |
980 | .B so | |
981 | and | |
982 | .BR se , | |
983 | respectively. | |
c4737001 | 984 | If the code to change into or out of standout |
ef978bfe | 985 | mode leaves one or even two blank spaces or garbage characters on the screen, |
c4737001 | 986 | as the TVI 912 and Teleray 1061 do, |
ef978bfe JB |
987 | then |
988 | .B sg | |
989 | should be given to tell how many characters are left. | |
c4737001 | 990 | .PP |
ef978bfe JB |
991 | Codes to begin underlining and end underlining can be given as |
992 | .B us | |
993 | and | |
994 | .BR ue , | |
995 | respectively. | |
996 | Underline mode change garbage is specified by | |
997 | .BR ug , | |
998 | similar to | |
999 | .BR sg . | |
c4737001 | 1000 | If the terminal has a code to underline the current character and move |
ef978bfe | 1001 | the cursor one position to the right, |
c4737001 | 1002 | such as the Microterm Mime, |
ef978bfe JB |
1003 | this can be given as |
1004 | .BR uc . | |
c4737001 | 1005 | .PP |
ef978bfe JB |
1006 | Other capabilities to enter various highlighting modes include |
1007 | .B mb | |
1008 | (blinking), | |
1009 | .B md | |
1010 | (bold or extra bright), | |
1011 | .B mh | |
1012 | (dim or half-bright), | |
1013 | .B mk | |
1014 | (blanking or invisible text), | |
1015 | .B mp | |
1016 | (protected), | |
1017 | .B mr | |
1018 | (reverse video), | |
1019 | .B me | |
1020 | (turn off | |
1021 | .I all | |
1022 | attribute modes), | |
1023 | .B as | |
1024 | (enter alternate character set mode), and | |
1025 | .B ae | |
1026 | (exit alternate character set mode). | |
1027 | Turning on any of these modes singly may or may not turn off other modes. | |
1028 | .PP | |
1029 | If there is a sequence to set arbitrary combinations of mode, | |
1030 | this should be given as | |
1031 | .B sa | |
1032 | (set attributes), taking 9 parameters. | |
1033 | Each parameter is either 0 or 1, | |
1034 | as the corresponding attributes is on or off. | |
1035 | The 9 parameters are, in order: standout, underline, reverse, blink, | |
1036 | dim, bold, blank, protect, and alternate character set. | |
1037 | Not all modes need be supported by | |
1038 | .BR sa , | |
1039 | only those for which corresponding attribute commands exist. | |
1040 | (It is unlikely that a | |
1041 | .IR termcap\^ -using | |
1042 | program will support this capability, which is defined for compatibility | |
1043 | with | |
1044 | .IR terminfo\^ .) | |
1045 | .PP | |
1046 | Terminals with the \*(lqmagic cookie\*(rq glitches | |
1047 | .RB ( sg | |
1048 | and | |
1049 | .BR ug ), | |
1050 | rather than maintaining extra attribute bits for each character cell, | |
1051 | instead deposit special \*(lqcookies\*(rq, | |
1052 | or \*(lqgarbage characters\*(rq, | |
1053 | when they receive mode-setting sequences, | |
1054 | which affect the display algorithm. | |
1055 | .PP | |
1056 | Some terminals, | |
1057 | such as the Hewlett-Packard 2621, | |
1058 | automatically leave standout | |
1059 | mode when they move to a new line or when the cursor is addressed. | |
1060 | Programs using standout mode | |
1061 | should exit standout mode on such terminals | |
1062 | before moving the cursor or sending a newline. | |
1063 | On terminals where this is not a problem, | |
1064 | the | |
1065 | .B ms | |
1066 | capability should be present | |
1067 | to say that this overhead is unnecessary. | |
c4737001 KM |
1068 | .PP |
1069 | If the terminal has | |
ef978bfe JB |
1070 | a way of flashing the screen to indicate an error quietly |
1071 | (a bell replacement), | |
c4737001 | 1072 | this can be given as |
ef978bfe JB |
1073 | .BR vb ; |
1074 | it must not move the cursor. | |
c4737001 | 1075 | .PP |
ef978bfe JB |
1076 | If the cursor needs to be made more visible than normal |
1077 | when it is not on the bottom line | |
1078 | (to change, for example, a non-blinking underline into an easier-to-find | |
1079 | block or blinking underline), | |
1080 | give this sequence as | |
1081 | .BR vs . | |
1082 | If there is a way to make the cursor completely invisible, give that as | |
1083 | .BR vi . | |
1084 | The capability | |
1085 | .BR ve , | |
1086 | which undoes the effects of both of these modes, | |
1087 | should also be given. | |
c4737001 | 1088 | .PP |
ef978bfe | 1089 | If your terminal correctly displays underlined characters |
c4737001 KM |
1090 | (with no special codes needed) |
1091 | even though it does not overstrike, | |
ef978bfe JB |
1092 | then you should give the capability |
1093 | .BR ul . | |
c4737001 | 1094 | If overstrikes are erasable with a blank, |
ef978bfe JB |
1095 | this should be indicated by giving |
1096 | .BR eo . | |
1097 | .br | |
1098 | .ne 5 | |
c4737001 KM |
1099 | .PP |
1100 | .B Keypad | |
1101 | .PP | |
1102 | If the terminal has a keypad that transmits codes when the keys are pressed, | |
ef978bfe JB |
1103 | this information can be given. |
1104 | Note that it is not possible to handle | |
1105 | terminals where the keypad only works in local mode | |
1106 | (this applies, for example, to the unshifted Hewlett-Packard 2621 keys). | |
c4737001 | 1107 | If the keypad can be set to transmit or not transmit, |
ef978bfe JB |
1108 | give these codes as |
1109 | .B ks | |
1110 | and | |
1111 | .BR ke . | |
c4737001 | 1112 | Otherwise the keypad is assumed to always transmit. |
ef978bfe JB |
1113 | The codes sent by the left-arrow, right-arrow, up-arrow, down-arrow, |
1114 | and home keys can be given as | |
1115 | .BR kl , | |
1116 | .BR kr , | |
1117 | .BR ku , | |
1118 | .BR kd , | |
1119 | and | |
1120 | .BR kh , | |
1121 | respectively. | |
c4737001 | 1122 | If there are function keys such as f0, f1, ..., f9, the codes they send |
ef978bfe JB |
1123 | can be given as |
1124 | .BR k0 , | |
1125 | .BR k1 , "" ..., | |
1126 | .BR k9 . | |
c4737001 | 1127 | If these keys have labels other than the default f0 through f9, the labels |
ef978bfe JB |
1128 | can be given as |
1129 | .BR l0 , | |
1130 | .BR l1 , "" ..., | |
1131 | .BR l9 . | |
1132 | The codes transmitted by certain other special keys can be given: | |
1133 | .B kH | |
1134 | (home down), | |
1135 | .B kb | |
1136 | (backspace), | |
1137 | .B ka | |
1138 | (clear all tabs), | |
1139 | .B kt | |
1140 | (clear the tab stop in this column), | |
1141 | .B kC | |
1142 | (clear screen or erase), | |
1143 | .B kD | |
1144 | (delete character), | |
1145 | .B kL | |
1146 | (delete line), | |
1147 | .B kM | |
1148 | (exit insert mode), | |
1149 | .B kE | |
1150 | (clear to end of line), | |
1151 | .B kS | |
1152 | (clear to end of screen), | |
1153 | .B kI | |
1154 | (insert character or enter insert mode), | |
1155 | .B kA | |
1156 | (insert line), | |
1157 | .B kN | |
1158 | (next page), | |
1159 | .B kP | |
1160 | (previous page), | |
1161 | .B kF | |
1162 | (scroll forward/down), | |
1163 | .B kR | |
1164 | (scroll backward/up), and | |
1165 | .B kT | |
1166 | (set a tab stop in this column). | |
1167 | In addition, if the keypad has a 3 by 3 array of keys | |
1168 | including the four arrow keys, then the other five keys can be given as | |
1169 | .BR K1 , | |
1170 | .BR K2 , | |
1171 | .BR K3 , | |
1172 | .BR K4 , | |
1173 | and | |
1174 | .BR K5 . | |
1175 | These keys are useful when the effects of a 3 by 3 directional pad are needed. | |
1176 | The obsolete | |
1177 | .B ko | |
1178 | capability formerly used to describe \*(lqother\*(rq function keys has been | |
1179 | completely supplanted by the above capabilities. | |
c4737001 KM |
1180 | .PP |
1181 | The | |
1182 | .B ma | |
ef978bfe JB |
1183 | entry is also used to indicate arrow keys on terminals that have |
1184 | single-character arrow keys. | |
1185 | It is obsolete but still in use in | |
1186 | version 2 of | |
1187 | .I vi\^ | |
1188 | which must be run on some minicomputers due to | |
c4737001 KM |
1189 | memory limitations. |
1190 | This field is redundant with | |
ef978bfe JB |
1191 | .BR kl , |
1192 | .BR kr , | |
1193 | .BR ku , | |
1194 | .BR kd , | |
1195 | and | |
1196 | .BR kh . | |
c4737001 | 1197 | It consists of groups of two characters. |
ef978bfe JB |
1198 | In each group, the first character is what an arrow key sends, and the |
1199 | second character is the corresponding | |
1200 | .I vi\^ | |
1201 | command. | |
c4737001 KM |
1202 | These commands are |
1203 | .B h | |
1204 | for | |
1205 | .BR kl , | |
1206 | .B j | |
1207 | for | |
1208 | .BR kd , | |
1209 | .B k | |
1210 | for | |
1211 | .BR ku , | |
1212 | .B l | |
1213 | for | |
1214 | .BR kr , | |
1215 | and | |
1216 | .B H | |
1217 | for | |
1218 | .BR kh . | |
ef978bfe | 1219 | For example, the Mime would have \*(lqma=^Hh^Kj^Zk^Xl\*(rq |
c4737001 | 1220 | indicating arrow keys left (^H), down (^K), up (^Z), and right (^X). |
ef978bfe JB |
1221 | (There is no home key on the Mime.) |
1222 | .br | |
1223 | .ne 5 | |
1224 | .PP | |
1225 | .B Tabs and Initialization | |
1226 | .PP | |
1227 | If the terminal needs to be in a special mode when running | |
1228 | a program that uses these capabilities, | |
1229 | the codes to enter and exit this mode can be given as | |
1230 | .B ti | |
1231 | and | |
1232 | .BR te . | |
1233 | This arises, for example, from terminals like the Concept with more than | |
1234 | one page of memory. | |
1235 | If the terminal has only memory-relative cursor addressing and not | |
1236 | screen-relative cursor addressing, | |
1237 | a screen-sized window must be fixed into | |
1238 | the display for cursor addressing to work properly. | |
1239 | This is also used for the Tektronix 4025, where | |
1240 | .B ti | |
1241 | sets the command character to be the one used by | |
1242 | .IR termcap\^ . | |
1243 | .PP | |
1244 | Other capabilities | |
1245 | include | |
1246 | .BR is , | |
1247 | an initialization string for the terminal, | |
1248 | and | |
1249 | .BR if , | |
1250 | the name of a file containing long initialization strings. | |
1251 | These strings are expected to set the terminal into modes | |
1252 | consistent with the rest of the | |
1253 | .I termcap\^ | |
1254 | description. | |
1255 | They are normally sent to the terminal by the | |
1256 | .I tset\^ | |
1257 | program each time the user logs in. | |
1258 | They will be printed in the following order: | |
1259 | .BR is ; | |
1260 | setting tabs using | |
1261 | .B ct | |
1262 | and | |
1263 | .BR st ; | |
1264 | and finally | |
1265 | .BR if . | |
1266 | .RI ( Terminfo\^ | |
1267 | uses | |
1268 | .B i1-i2 | |
1269 | instead of | |
1270 | .B is | |
1271 | and runs the program | |
1272 | .B iP | |
1273 | and prints | |
1274 | .B i3 | |
1275 | after the other initializations.) | |
1276 | A pair of sequences that does a harder reset from a totally unknown state | |
1277 | can be analogously given as | |
1278 | .B rs | |
1279 | and | |
1280 | .BR if . | |
1281 | These strings are output by the | |
1282 | .I reset\^ | |
1283 | program, which is used when the terminal gets into a wedged state. | |
1284 | .RI ( Terminfo\^ | |
1285 | uses | |
1286 | .B r1-r3 | |
1287 | instead of | |
1288 | .BR rs .) | |
1289 | Commands are normally placed in | |
1290 | .B rs | |
1291 | and | |
1292 | .B rf | |
1293 | only if they produce annoying effects on the screen and are not necessary | |
1294 | when logging in. | |
1295 | For example, the command to set the VT100 into 80-column mode | |
1296 | would normally be part of | |
1297 | .BR is , | |
1298 | but it causes an annoying glitch of the screen and is not normally needed | |
1299 | since the terminal is usually already in 80-column mode. | |
1300 | .PP | |
1301 | If the terminal has hardware tabs, | |
1302 | the command to advance to the next tab stop can be given as | |
1303 | .B ta | |
1304 | (usually | |
1305 | .BR ^I ). | |
1306 | A \*(lqbacktab\*(rq command which moves leftward to the previous tab stop | |
1307 | can be given as | |
1308 | .BR bt . | |
1309 | By convention, | |
1310 | if the terminal driver modes indicate that tab stops are being expanded | |
1311 | by the computer rather than being sent to the terminal, | |
1312 | programs should not use | |
1313 | .B ta | |
1314 | or | |
1315 | .B bt | |
1316 | even if they are present, | |
1317 | since the user may not have the tab stops properly set. | |
1318 | If the terminal has hardware tabs that are initially set every | |
1319 | .I n\^ | |
1320 | positions when the terminal is powered up, then the numeric parameter | |
1321 | .B it | |
1322 | is given, showing the number of positions between tab stops. | |
1323 | This is normally used by the | |
1324 | .I tset\^ | |
1325 | command to determine whether to set the driver mode for hardware tab | |
1326 | expansion, and whether to set the tab stops. | |
1327 | If the terminal has tab stops that can be saved in nonvolatile memory, the | |
1328 | .I termcap\^ | |
1329 | description can assume that they are properly set. | |
1330 | .PP | |
1331 | If there are commands to set and clear tab stops, they can be given as | |
1332 | .B ct | |
1333 | (clear all tab stops) and | |
1334 | .B st | |
1335 | (set a tab stop in the current column of every row). | |
1336 | If a more complex sequence is needed to set the tabs than can be | |
1337 | described by this, the sequence can be placed in | |
1338 | .B is | |
1339 | or | |
1340 | .BR if . | |
1341 | .br | |
1342 | .ne 5 | |
1343 | .PP | |
1344 | .B Delays | |
1345 | .PP | |
1346 | Certain capabilities control padding in the terminal driver. | |
1347 | These are primarily needed by hardcopy terminals and are used by the | |
1348 | .I tset\^ | |
1349 | program to set terminal driver modes appropriately. | |
1350 | Delays embedded in the capabilities | |
1351 | .BR cr , | |
1352 | .BR sf , | |
1353 | .BR le , | |
1354 | .BR ff , | |
1355 | and | |
1356 | .B ta | |
1357 | will cause the appropriate delay bits to be set in the terminal driver. | |
1358 | If | |
1359 | .B pb | |
1360 | (padding baud rate) is given, these values can be ignored at baud rates | |
1361 | below the value of | |
1362 | .BR pb . | |
1363 | For 4.2BSD | |
1364 | .IR tset\^ , | |
1365 | the delays are given as numeric capabilities | |
1366 | .BR dC , | |
1367 | .BR dN , | |
1368 | .BR dB , | |
1369 | .BR dF , | |
1370 | and | |
1371 | .BR dT | |
1372 | instead. | |
1373 | .br | |
1374 | .ne 5 | |
c4737001 KM |
1375 | .PP |
1376 | .B Miscellaneous | |
1377 | .PP | |
ef978bfe JB |
1378 | If the terminal requires other than a \s-2NUL\s0 (zero) character as a pad, |
1379 | this can be given as | |
1380 | .BR pc . | |
1381 | Only the first character of the | |
1382 | .B pc | |
1383 | string is used. | |
1384 | .PP | |
1385 | If the terminal has commands to save and restore the position of the | |
1386 | cursor, give them as | |
1387 | .B sc | |
1388 | and | |
1389 | .BR rc . | |
1390 | .PP | |
1391 | If the terminal has an extra \*(lqstatus line\*(rq that is not normally used by | |
1392 | software, this fact can be indicated. | |
1393 | If the status line is viewed as an extra line below the bottom line, | |
1394 | then the capability | |
1395 | .B hs | |
1396 | should be given. | |
1397 | Special strings to go to a position in the status line and to return | |
1398 | from the status line can be given as | |
1399 | .B ts | |
1400 | and | |
1401 | .BR fs . | |
1402 | .RB ( fs | |
1403 | must leave the cursor position in the same place that it was before | |
1404 | .BR ts . | |
1405 | If necessary, the | |
1406 | .B sc | |
1407 | and | |
1408 | .B rc | |
1409 | strings can be included in | |
1410 | .B ts | |
1411 | and | |
1412 | .B fs | |
1413 | to get this effect.) | |
1414 | The capability | |
1415 | .B ts | |
1416 | takes one parameter, which is the column number of the status line | |
1417 | to which the cursor is to be moved. | |
1418 | If escape sequences and other special commands such as tab work while in | |
1419 | the status line, the flag | |
1420 | .B es | |
1421 | can be given. | |
1422 | A string that turns off the status line (or otherwise erases its contents) | |
1423 | should be given as | |
1424 | .BR ds . | |
1425 | The status line is normally assumed to be the same width as the | |
1426 | rest of the screen, | |
1427 | .IR i.e. , | |
1428 | .BR co . | |
1429 | If the status line is a different width (possibly because the terminal | |
1430 | does not allow an entire line to be loaded), then its width in columns | |
1431 | can be indicated with the numeric parameter | |
1432 | .BR ws . | |
1433 | .PP | |
1434 | If the terminal can move up or down half a line, this can be | |
1435 | indicated with | |
1436 | .B hu | |
1437 | (half-line up) and | |
1438 | .B hd | |
1439 | (half-line down). | |
1440 | This is primarily useful for superscripts and subscripts on hardcopy | |
1441 | terminals. | |
1442 | If a hardcopy terminal can eject to the next page (form feed), | |
1443 | give this as | |
1444 | .B ff | |
1445 | (usually | |
1446 | .BR ^L ). | |
1447 | .PP | |
1448 | If there is a command to repeat a given character a given number of times | |
1449 | (to save time transmitting a large number of identical characters), | |
1450 | this can be indicated with the parameterized string | |
1451 | .BR rp . | |
1452 | The first parameter is the character to be repeated and the second is | |
1453 | the number of times to repeat it. | |
1454 | (This is a | |
1455 | .I terminfo\^ | |
1456 | feature that is unlikely to be supported by a program that uses | |
1457 | .IR termcap\^ .) | |
1458 | .PP | |
1459 | If the terminal has a settable command character, such as the | |
1460 | Tektronix 4025, this can be indicated with | |
1461 | .BR CC . | |
1462 | A prototype command character is chosen which is used in all capabilities. | |
1463 | This character is given in the | |
1464 | .B CC | |
1465 | capability to identify it. | |
1466 | The following convention is supported on some UNIX systems: | |
1467 | The environment is to be searched for a | |
1468 | .B | |
1469 | .SM CC | |
1470 | variable, | |
1471 | and if found, | |
1472 | all occurrences of the prototype character are replaced by the character | |
1473 | in the environment variable. | |
1474 | This use of the | |
1475 | .B | |
1476 | .SM CC | |
1477 | environment variable | |
1478 | is a very bad idea, as it conflicts with | |
1479 | .IR make\^ (1). | |
1480 | .PP | |
1481 | Terminal descriptions that do not represent a specific kind of known | |
1482 | terminal, such as | |
1483 | .IR switch\^ , | |
1484 | .IR dialup\^ , | |
1485 | .IR patch\^ , | |
1486 | and | |
1487 | .IR network\^ , | |
1488 | should include the | |
1489 | .B gn | |
1490 | (generic) capability so that programs can complain that they do not know | |
1491 | how to talk to the terminal. | |
1492 | (This capability does not apply to | |
1493 | .I virtual\^ | |
1494 | terminal descriptions for which the escape sequences are known.) | |
1495 | .PP | |
1496 | If the terminal uses xoff/xon (\s-2DC3\s0/\s-2DC1\s0) | |
1497 | handshaking for flow control, give | |
1498 | .BR xo . | |
1499 | Padding information should still be included so that routines can make | |
1500 | better decisions about costs, but actual pad characters will not be | |
1501 | transmitted. | |
1502 | .PP | |
1503 | If the terminal has a \*(lqmeta key\*(rq which acts as a shift key, setting the | |
1504 | 8th bit of any character transmitted, then this fact can be indicated with | |
1505 | .BR km . | |
1506 | Otherwise, software will assume that the 8th bit is parity and it will | |
1507 | usually be cleared. | |
1508 | If strings exist to turn this \*(lqmeta mode\*(rq on and off, they can be given as | |
1509 | .B mm | |
1510 | and | |
1511 | .BR mo . | |
1512 | .PP | |
1513 | If the terminal has more lines of memory than will fit on the screen at once, | |
1514 | the number of lines of memory can be indicated with | |
1515 | .BR lm . | |
1516 | An explicit value of 0 indicates that the number of lines is not fixed, | |
1517 | but that there is still more memory than fits on the screen. | |
1518 | .PP | |
1519 | If the terminal is one of those supported by the UNIX system virtual | |
1520 | terminal protocol, the terminal number can be given as | |
1521 | .BR vt . | |
1522 | .PP | |
1523 | Media copy strings which control an auxiliary printer | |
1524 | connected to the terminal can be given as | |
1525 | .BR ps : | |
1526 | print the contents of the screen; | |
1527 | .BR pf : | |
1528 | turn off the printer; and | |
1529 | .BR po : | |
1530 | turn on the printer. | |
1531 | When the printer is on, all text sent to the terminal will be sent to the | |
1532 | printer. | |
1533 | It is undefined whether the text is also displayed on the terminal screen | |
1534 | when the printer is on. | |
1535 | A variation | |
1536 | .B pO | |
1537 | takes one parameter and leaves the printer on for as many characters as the | |
1538 | value of the parameter, then turns the printer off. | |
1539 | The parameter should not exceed 255. | |
1540 | All text, including | |
1541 | .BR pf , | |
1542 | is transparently passed to the printer while | |
1543 | .B pO | |
1544 | is in effect. | |
1545 | .PP | |
1546 | Strings to program function keys can be given as | |
1547 | .BR pk , | |
1548 | .BR pl , | |
1549 | and | |
1550 | .BR px . | |
1551 | Each of these strings takes two parameters: the function key number | |
1552 | to program (from 0 to 9) and the string to program it with. | |
1553 | Function key numbers out of this range may program undefined keys | |
1554 | in a terminal-dependent manner. | |
1555 | The differences among the capabilities are that | |
1556 | .B pk | |
1557 | causes pressing the given key to be the same as the user typing the given | |
1558 | string; | |
1559 | .B pl | |
1560 | causes the string to be executed by the terminal in local mode; | |
1561 | and | |
1562 | .B px | |
1563 | causes the string to be transmitted to the computer. | |
1564 | Unfortunately, due to lack of a definition for string parameters in | |
1565 | .IR termcap\^ , | |
1566 | only | |
1567 | .I terminfo\^ | |
1568 | supports these capabilities. | |
1569 | .br | |
1570 | .ne 5 | |
1571 | .PP | |
1572 | .B Glitches and Braindamage | |
1573 | .PP | |
1574 | Hazeltine terminals, which do not allow `~' characters to be displayed, | |
1575 | should indicate | |
1576 | .BR hz . | |
1577 | .PP | |
1578 | The | |
1579 | .B nc | |
1580 | capability, now obsolete, formerly indicated Datamedia terminals, | |
1581 | which echo | |
1582 | .B \er \en | |
1583 | for | |
1584 | carriage return then ignore a following linefeed. | |
1585 | .PP | |
1586 | Terminals that ignore a linefeed immediately after an | |
1587 | .B am | |
1588 | wrap, such as the Concept, should indicate | |
1589 | .BR xn . | |
1590 | .PP | |
1591 | If | |
1592 | .B ce | |
1593 | is required to get rid of standout | |
1594 | (instead of merely writing normal text on top of it), | |
1595 | .B xs | |
1596 | should be given. | |
1597 | .PP | |
c4737001 | 1598 | Teleray terminals, where tabs turn all characters moved over to blanks, |
ef978bfe JB |
1599 | should indicate |
1600 | .B xt | |
1601 | (destructive tabs). | |
1602 | This glitch is also taken to mean that it is not possible | |
1603 | to position the cursor on top of a \*(lqmagic cookie\*(rq, and that | |
1604 | to erase standout mode it is necessary to use delete and insert line. | |
c4737001 | 1605 | .PP |
ef978bfe JB |
1606 | The Beehive Superbee, which is unable to correctly transmit the |
1607 | \s-2ESC\s0 or ^C characters, has | |
1608 | .BR xb , | |
1609 | indicating that the \*(lqf1\*(rq key is used for \s-2ESC\s0 and \*(lqf2\*(rq for ^C. | |
1610 | (Only certain Superbees have this problem, depending on the ROM.) | |
1611 | .PP | |
1612 | Other specific terminal problems may be corrected by adding more | |
1613 | capabilities of the form \fBx\fIx\^\fP. | |
1614 | .br | |
1615 | .ne 5 | |
c4737001 KM |
1616 | .PP |
1617 | .B Similar Terminals | |
1618 | .PP | |
1619 | If there are two very similar terminals, | |
1620 | one can be defined as being just like the other with certain exceptions. | |
ef978bfe JB |
1621 | The string capability |
1622 | .B tc | |
1623 | can be given | |
c4737001 | 1624 | with the name of the similar terminal. |
ef978bfe JB |
1625 | This capability must be |
1626 | .IR last\^ , | |
1627 | and the combined length of the entries | |
1628 | must not exceed 1024. | |
1629 | The capabilities given before | |
1630 | .B tc | |
1631 | override those in the terminal type invoked by | |
1632 | .BR tc . | |
1633 | A capability can be canceled by placing | |
1634 | .B xx@ | |
1635 | to the left of the | |
1636 | .B tc | |
1637 | invocation, where | |
1638 | .I xx\^ | |
1639 | is the capability. | |
c4737001 KM |
1640 | For example, the entry |
1641 | .PP | |
ef978bfe | 1642 | hn\||\|2621\-nl:ks@:ke@:tc=2621: |
c4737001 | 1643 | .PP |
ef978bfe JB |
1644 | defines a \*(lq2621\-nl\*(rq that does not have the |
1645 | .B ks | |
1646 | or | |
1647 | .B ke | |
1648 | capabilities, | |
1649 | hence does not turn on the function key labels when in visual mode. | |
c4737001 KM |
1650 | This is useful for different modes for a terminal, or for different |
1651 | user preferences. | |
c4737001 KM |
1652 | .SH AUTHOR |
1653 | William Joy | |
1654 | .br | |
1655 | Mark Horton added underlining and keypad support | |
ef978bfe JB |
1656 | .SH FILES |
1657 | .DT | |
1658 | /etc/termcap file containing terminal descriptions | |
1659 | .SH SEE ALSO | |
1660 | ex(1), more(1), tset(1), ul(1), vi(1), curses(3X), printf(3S), term(7). | |
1661 | .SH "CAVEATS AND BUGS" | |
1662 | .B Note: | |
1663 | .I termcap\^ | |
1664 | was replaced by | |
1665 | .I terminfo\^ | |
1666 | in UNIX System V Release 2.0. | |
1667 | The transition will be relatively painless if capabilities flagged as | |
1668 | \*(lqobsolete\*(rq are avoided. | |
1669 | .PP | |
f3531ae0 JB |
1670 | Lines and columns are now stored by the kernel as well as in the termcap |
1671 | entry. | |
1672 | Most programs now use the kernel information primarily; the information | |
1673 | in this file is used only if the kernel does not have any information. | |
1674 | .PP | |
ef978bfe | 1675 | .I Vi\^ |
c4737001 KM |
1676 | allows only 256 characters for string capabilities, and the routines |
1677 | in | |
ef978bfe | 1678 | .IR termlib\^ (3) |
c4737001 KM |
1679 | do not check for overflow of this buffer. |
1680 | The total length of a single entry (excluding only escaped newlines) | |
1681 | may not exceed 1024. | |
1682 | .PP | |
c4737001 | 1683 | Not all programs support all entries. |