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