added psterm entries (for NeWS) from Grasshopper Group
[unix-history] / usr / src / share / termcap / 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.\"
dc9699ea 5.\" @(#)termcap.5 6.6 (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
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
dc9699ea
JK
689The Datamedia 2500 needs the current row and column sent
690encoded in binary using \*(lq%.\*(rq.
ef978bfe
JB
691Terminals that use \*(lq%.\*(rq need to be able to
692backspace the cursor
693.RB ( le )
694and to move the cursor up one line on the screen
695.RB ( up ).
696This is necessary because it is not always safe to transmit
697.BR \en ,
698.BR ^D ,
699and
700.BR \er ,
701as the system may change or discard them.
702(Programs using
703.I termcap\^
704must set terminal modes so that tabs are not expanded, so
705.B \et
706is safe to send.
707This turns out to be essential for the Ann Arbor 4080.)
708.PP
709A final example is the Lear Siegler \s-1ADM\s0\-3a,
710which offsets row and column
711by a blank character, thus \*(lqcm=\eE=%+ %+ \*(rq.
712.PP
713Row or column absolute cursor addressing
714can be given as single parameter capabilities
715.B ch
716(horizontal position absolute) and
717.B cv
718(vertical position absolute).
719Sometimes these are shorter than the more general two-parameter sequence
720(as with the Hewlett-Packard 2645) and can be used in preference to
721.BR cm .
722If there are parameterized local motions
723.RI ( e.g. ,
724move
725.I n\^
726positions to the right)
727these can be given as
728.BR DO ,
729.BR LE ,
730.BR RI ,
731and
732.B UP
733with a single parameter indicating how many positions to move.
734These are primarily useful if the terminal does not have
735.BR cm ,
736such as the Tektronix 4025.
737.br
738.ne 5
739.PP
740.B Cursor Motions
741.PP
742If the terminal has a fast way to home the cursor
743(to the very upper left corner of the screen), this can be given as
744.BR ho .
745Similarly, a fast way of getting to the lower left-hand corner
746can be given as
747.BR ll ;
748this may involve going up with
749.B up
c4737001 750from the home position,
ef978bfe
JB
751but a program should never do this itself (unless
752.B ll
753does), because it can
754make no assumption about the effect of moving up from the home position.
755Note that the home position is the same as
756cursor address (0,0): to the top left corner of the screen, not of memory.
757(Therefore, the \*(lq\eEH\*(rq sequence on Hewlett-Packard terminals
758cannot be used for
759.BR ho .)
760.br
761.ne 5
c4737001 762.PP
ef978bfe 763.B Area Clears
c4737001
KM
764.PP
765If the terminal can clear from the current position to the end of the
ef978bfe
JB
766line, leaving the cursor where it is, this should be given as
767.BR ce .
c4737001 768If the terminal can clear from the current position to the end of the
ef978bfe
JB
769display, this should be given as
770.BR cd .
771.B cd
772must only be invoked from the first column of a line.
773(Therefore,
774it can be simulated by a request to delete a large number of lines,
775if a true
776.B cd
777is not available.)
778.br
779.ne 5
c4737001 780.PP
ef978bfe 781.B Insert/Delete Line
c4737001 782.PP
ef978bfe
JB
783If the terminal can open a new blank line
784before the line containing the cursor,
785this should be given as
786.BR al ;
787this must be invoked only from the first
788position of a line.
789The cursor must then appear at the left of the newly blank line.
790If the terminal can delete the line that the cursor is on, this
791should be given as
792.BR dl ;
793this must only be used from the first position on
c4737001 794the line to be deleted.
ef978bfe
JB
795Versions of
796.B al
797and
798.B dl
799which take a single parameter
800and insert or delete that many lines
801can be given as
802.B AL
803and
804.BR DL .
805If the terminal has a settable scrolling region
806(like the VT100),
807the command to set this can be described with the
808.B cs
809capability,
810which takes two parameters: the top and bottom lines of the scrolling region.
811The cursor position is, alas, undefined after using this command.
812It is possible to get the effect of insert or delete line
813using this command \(em the
814.B sc
815and
816.B rc
817(save and restore cursor) commands are also useful.
818Inserting lines at the top or bottom of the screen can also be done using
819.B sr
820or
821.B sf
822on many terminals without a true insert/delete line,
823and is often faster even on terminals with those features.
824.PP
825If the terminal has the ability to define a window as part of memory
826which all commands affect, it should be given as the parameterized string
827.BR wi .
828The four parameters are the starting and ending lines in memory
829and the starting and ending columns in memory, in that order.
830(This
831.I terminfo\^
832capability is described for completeness.
833It is unlikely that any
834.IR termcap\^ -using
835program will support it.)
836.PP
837If the terminal can retain display memory above the screen, then the
838.B da
839capability should be given;
840if display memory can be retained
841below, then
842.B db
843should be given.
844These indicate
845that deleting a line or scrolling may bring non-blank lines up from below
846or that scrolling back with
847.B sr
848may bring down non-blank lines.
849.br
850.ne 5
c4737001 851.PP
ef978bfe 852.B Insert/Delete Character
c4737001
KM
853.PP
854There are two basic kinds of intelligent terminals with respect to
ef978bfe
JB
855insert/delete character that can be described using
856.IR termcap\^ .
c4737001
KM
857The most common insert/delete character operations affect only the characters
858on the current line and shift characters off the end of the line rigidly.
ef978bfe 859Other terminals, such as the Concept\-100 and the Perkin Elmer Owl, make
c4737001
KM
860a distinction between typed and untyped blanks on the screen, shifting
861upon an insert or delete only to an untyped blank on the screen which is
ef978bfe
JB
862either eliminated or expanded to two untyped blanks.
863You can determine
864the kind of terminal you have by clearing the screen then typing
865text separated by cursor motions.
866Type \*(lqabc\ \ \ \ def\*(rq using local
c4737001
KM
867cursor motions (not spaces) between the \*(lqabc\*(rq and the \*(lqdef\*(rq.
868Then position the cursor before the \*(lqabc\*(rq and put the terminal in insert
ef978bfe
JB
869mode.
870If typing characters causes the rest of the line to shift
c4737001 871rigidly and characters to fall off the end, then your terminal does
ef978bfe
JB
872not distinguish between blanks and untyped positions.
873If the \*(lqabc\*(rq
c4737001 874shifts over to the \*(lqdef\*(rq which then move together around the end of the
ef978bfe
JB
875current line and onto the next as you insert, then you have the second type of
876terminal and should give the capability \fBin\fP, which stands for
877\*(lqinsert null\*(rq.
878While these are two logically separate attributes
879(one line
880.I vs.
881multi-line insert mode,
882and special treatment of untyped spaces),
883we have seen no terminals whose insert
884mode cannot be described with the single attribute.
885.PP
886.I Termcap\^
887can describe both terminals that have an insert mode and terminals
888that send a simple sequence to open a blank position on the current line.
889Give as
890.B im
891the sequence to get into insert mode.
892Give as
893.B ei
894the sequence to leave insert mode.
895Now give as
896.B ic
897any sequence that needs to be sent just before
898each character to be inserted.
899Most terminals with a true insert mode
900will not give
901.BR ic ;
902terminals that use a sequence to open a screen
903position should give it here.
904(If your terminal has both,
905insert mode is usually preferable to
906.BR ic .
907Do not give both unless the terminal actually requires both to be used
908in combination.)
909If post-insert padding is needed, give this as a number of milliseconds
910in
911.B ip
912(a string option).
913Any other sequence that may need to be
914sent after insertion of a single character can also be given in
915.BR ip .
916If your terminal needs to be placed into an `insert mode'
917and needs a special code preceding each inserted character,
918then both
919.BR im / ei
920and
921.B ic
922can be given, and both will be used.
923The
924.B IC
925capability, with one parameter
926.IR n\^ ,
927will repeat the effects of
928.B ic
929.I n\^
930times.
c4737001
KM
931.PP
932It is occasionally necessary to move around while in insert mode
ef978bfe
JB
933to delete characters on the same line
934.RI ( e.g. ,
935if there is a tab after
936the insertion position).
937If your terminal allows motion while in
938insert mode, you can give the capability
939.B mi
940to speed up inserting
941in this case.
942Omitting
943.B mi
944will affect only speed.
945Some terminals
946(notably Datamedia's) must not have
947.B mi
948because of the way their
c4737001
KM
949insert mode works.
950.PP
ef978bfe
JB
951Finally, you can specify
952.B dc
953to delete a single character,
954.B DC
955with one parameter
956.I n\^
957to delete
958.I n\^
959characters,
960and delete mode by giving
961.B dm
962and
963.B ed
964to enter and exit delete mode
965(which is any mode the terminal needs to be placed in for
966.B dc
967to work).
968.br
969.ne 5
c4737001 970.PP
ef978bfe 971.B Highlighting, Underlining, and Visible Bells
c4737001 972.PP
ef978bfe
JB
973If your terminal has one or more kinds of display attributes,
974these can be represented in a number of different ways.
975You should choose one display form as
976.IR "standout mode" ,
977representing a good high-contrast, easy-on-the-eyes format
978for highlighting error messages and other attention getters.
979(If you have a choice, reverse video plus half-bright is good,
980or reverse video alone.)
981The sequences to enter and exit standout mode
982are given as
983.B so
984and
985.BR se ,
986respectively.
c4737001 987If the code to change into or out of standout
ef978bfe 988mode leaves one or even two blank spaces or garbage characters on the screen,
c4737001 989as the TVI 912 and Teleray 1061 do,
ef978bfe
JB
990then
991.B sg
992should be given to tell how many characters are left.
c4737001 993.PP
ef978bfe
JB
994Codes to begin underlining and end underlining can be given as
995.B us
996and
997.BR ue ,
998respectively.
999Underline mode change garbage is specified by
1000.BR ug ,
1001similar to
1002.BR sg .
c4737001 1003If the terminal has a code to underline the current character and move
ef978bfe 1004the cursor one position to the right,
c4737001 1005such as the Microterm Mime,
ef978bfe
JB
1006this can be given as
1007.BR uc .
c4737001 1008.PP
ef978bfe
JB
1009Other capabilities to enter various highlighting modes include
1010.B mb
1011(blinking),
1012.B md
1013(bold or extra bright),
1014.B mh
1015(dim or half-bright),
1016.B mk
1017(blanking or invisible text),
1018.B mp
1019(protected),
1020.B mr
1021(reverse video),
1022.B me
1023(turn off
1024.I all
1025attribute modes),
1026.B as
1027(enter alternate character set mode), and
1028.B ae
1029(exit alternate character set mode).
1030Turning on any of these modes singly may or may not turn off other modes.
1031.PP
1032If there is a sequence to set arbitrary combinations of mode,
1033this should be given as
1034.B sa
1035(set attributes), taking 9 parameters.
1036Each parameter is either 0 or 1,
1037as the corresponding attributes is on or off.
1038The 9 parameters are, in order: standout, underline, reverse, blink,
1039dim, bold, blank, protect, and alternate character set.
1040Not all modes need be supported by
1041.BR sa ,
1042only those for which corresponding attribute commands exist.
1043(It is unlikely that a
1044.IR termcap\^ -using
1045program will support this capability, which is defined for compatibility
1046with
1047.IR terminfo\^ .)
1048.PP
1049Terminals with the \*(lqmagic cookie\*(rq glitches
1050.RB ( sg
1051and
1052.BR ug ),
1053rather than maintaining extra attribute bits for each character cell,
1054instead deposit special \*(lqcookies\*(rq,
1055or \*(lqgarbage characters\*(rq,
1056when they receive mode-setting sequences,
1057which affect the display algorithm.
1058.PP
1059Some terminals,
1060such as the Hewlett-Packard 2621,
1061automatically leave standout
1062mode when they move to a new line or when the cursor is addressed.
1063Programs using standout mode
1064should exit standout mode on such terminals
1065before moving the cursor or sending a newline.
1066On terminals where this is not a problem,
1067the
1068.B ms
1069capability should be present
1070to say that this overhead is unnecessary.
c4737001
KM
1071.PP
1072If the terminal has
ef978bfe
JB
1073a way of flashing the screen to indicate an error quietly
1074(a bell replacement),
c4737001 1075this can be given as
ef978bfe
JB
1076.BR vb ;
1077it must not move the cursor.
c4737001 1078.PP
ef978bfe
JB
1079If the cursor needs to be made more visible than normal
1080when it is not on the bottom line
1081(to change, for example, a non-blinking underline into an easier-to-find
1082block or blinking underline),
1083give this sequence as
1084.BR vs .
1085If there is a way to make the cursor completely invisible, give that as
1086.BR vi .
1087The capability
1088.BR ve ,
1089which undoes the effects of both of these modes,
1090should also be given.
c4737001 1091.PP
ef978bfe 1092If your terminal correctly displays underlined characters
c4737001
KM
1093(with no special codes needed)
1094even though it does not overstrike,
ef978bfe
JB
1095then you should give the capability
1096.BR ul .
c4737001 1097If overstrikes are erasable with a blank,
ef978bfe
JB
1098this should be indicated by giving
1099.BR eo .
1100.br
1101.ne 5
c4737001
KM
1102.PP
1103.B Keypad
1104.PP
1105If the terminal has a keypad that transmits codes when the keys are pressed,
ef978bfe
JB
1106this information can be given.
1107Note that it is not possible to handle
1108terminals where the keypad only works in local mode
1109(this applies, for example, to the unshifted Hewlett-Packard 2621 keys).
c4737001 1110If the keypad can be set to transmit or not transmit,
ef978bfe
JB
1111give these codes as
1112.B ks
1113and
1114.BR ke .
c4737001 1115Otherwise the keypad is assumed to always transmit.
ef978bfe
JB
1116The codes sent by the left-arrow, right-arrow, up-arrow, down-arrow,
1117and home keys can be given as
1118.BR kl ,
1119.BR kr ,
1120.BR ku ,
1121.BR kd ,
1122and
1123.BR kh ,
1124respectively.
c4737001 1125If there are function keys such as f0, f1, ..., f9, the codes they send
ef978bfe
JB
1126can be given as
1127.BR k0 ,
1128.BR k1 , "" ...,
1129.BR k9 .
c4737001 1130If these keys have labels other than the default f0 through f9, the labels
ef978bfe
JB
1131can be given as
1132.BR l0 ,
1133.BR l1 , "" ...,
1134.BR l9 .
1135The codes transmitted by certain other special keys can be given:
1136.B kH
1137(home down),
1138.B kb
1139(backspace),
1140.B ka
1141(clear all tabs),
1142.B kt
1143(clear the tab stop in this column),
1144.B kC
1145(clear screen or erase),
1146.B kD
1147(delete character),
1148.B kL
1149(delete line),
1150.B kM
1151(exit insert mode),
1152.B kE
1153(clear to end of line),
1154.B kS
1155(clear to end of screen),
1156.B kI
1157(insert character or enter insert mode),
1158.B kA
1159(insert line),
1160.B kN
1161(next page),
1162.B kP
1163(previous page),
1164.B kF
1165(scroll forward/down),
1166.B kR
1167(scroll backward/up), and
1168.B kT
1169(set a tab stop in this column).
1170In addition, if the keypad has a 3 by 3 array of keys
1171including the four arrow keys, then the other five keys can be given as
1172.BR K1 ,
1173.BR K2 ,
1174.BR K3 ,
1175.BR K4 ,
1176and
1177.BR K5 .
1178These keys are useful when the effects of a 3 by 3 directional pad are needed.
1179The obsolete
1180.B ko
1181capability formerly used to describe \*(lqother\*(rq function keys has been
1182completely supplanted by the above capabilities.
c4737001
KM
1183.PP
1184The
1185.B ma
ef978bfe
JB
1186entry is also used to indicate arrow keys on terminals that have
1187single-character arrow keys.
1188It is obsolete but still in use in
1189version 2 of
1190.I vi\^
1191which must be run on some minicomputers due to
c4737001
KM
1192memory limitations.
1193This field is redundant with
ef978bfe
JB
1194.BR kl ,
1195.BR kr ,
1196.BR ku ,
1197.BR kd ,
1198and
1199.BR kh .
c4737001 1200It consists of groups of two characters.
ef978bfe
JB
1201In each group, the first character is what an arrow key sends, and the
1202second character is the corresponding
1203.I vi\^
1204command.
c4737001
KM
1205These commands are
1206.B h
1207for
1208.BR kl ,
1209.B j
1210for
1211.BR kd ,
1212.B k
1213for
1214.BR ku ,
1215.B l
1216for
1217.BR kr ,
1218and
1219.B H
1220for
1221.BR kh .
ef978bfe 1222For example, the Mime would have \*(lqma=^Hh^Kj^Zk^Xl\*(rq
c4737001 1223indicating arrow keys left (^H), down (^K), up (^Z), and right (^X).
ef978bfe
JB
1224(There is no home key on the Mime.)
1225.br
1226.ne 5
1227.PP
1228.B Tabs and Initialization
1229.PP
1230If the terminal needs to be in a special mode when running
1231a program that uses these capabilities,
1232the codes to enter and exit this mode can be given as
1233.B ti
1234and
1235.BR te .
1236This arises, for example, from terminals like the Concept with more than
1237one page of memory.
1238If the terminal has only memory-relative cursor addressing and not
1239screen-relative cursor addressing,
1240a screen-sized window must be fixed into
1241the display for cursor addressing to work properly.
1242This is also used for the Tektronix 4025, where
1243.B ti
1244sets the command character to be the one used by
1245.IR termcap\^ .
1246.PP
1247Other capabilities
1248include
1249.BR is ,
1250an initialization string for the terminal,
1251and
1252.BR if ,
1253the name of a file containing long initialization strings.
1254These strings are expected to set the terminal into modes
1255consistent with the rest of the
1256.I termcap\^
1257description.
1258They are normally sent to the terminal by the
1259.I tset\^
1260program each time the user logs in.
1261They will be printed in the following order:
1262.BR is ;
1263setting tabs using
1264.B ct
1265and
1266.BR st ;
1267and finally
1268.BR if .
1269.RI ( Terminfo\^
1270uses
1271.B i1-i2
1272instead of
1273.B is
1274and runs the program
1275.B iP
1276and prints
1277.B i3
1278after the other initializations.)
1279A pair of sequences that does a harder reset from a totally unknown state
1280can be analogously given as
1281.B rs
1282and
1283.BR if .
1284These strings are output by the
1285.I reset\^
1286program, which is used when the terminal gets into a wedged state.
1287.RI ( Terminfo\^
1288uses
1289.B r1-r3
1290instead of
1291.BR rs .)
1292Commands are normally placed in
1293.B rs
1294and
1295.B rf
1296only if they produce annoying effects on the screen and are not necessary
1297when logging in.
1298For example, the command to set the VT100 into 80-column mode
1299would normally be part of
1300.BR is ,
1301but it causes an annoying glitch of the screen and is not normally needed
1302since the terminal is usually already in 80-column mode.
1303.PP
1304If the terminal has hardware tabs,
1305the command to advance to the next tab stop can be given as
1306.B ta
1307(usually
1308.BR ^I ).
1309A \*(lqbacktab\*(rq command which moves leftward to the previous tab stop
1310can be given as
1311.BR bt .
1312By convention,
1313if the terminal driver modes indicate that tab stops are being expanded
1314by the computer rather than being sent to the terminal,
1315programs should not use
1316.B ta
1317or
1318.B bt
1319even if they are present,
1320since the user may not have the tab stops properly set.
1321If the terminal has hardware tabs that are initially set every
1322.I n\^
1323positions when the terminal is powered up, then the numeric parameter
1324.B it
1325is given, showing the number of positions between tab stops.
1326This is normally used by the
1327.I tset\^
1328command to determine whether to set the driver mode for hardware tab
1329expansion, and whether to set the tab stops.
1330If the terminal has tab stops that can be saved in nonvolatile memory, the
1331.I termcap\^
1332description can assume that they are properly set.
1333.PP
1334If there are commands to set and clear tab stops, they can be given as
1335.B ct
1336(clear all tab stops) and
1337.B st
1338(set a tab stop in the current column of every row).
1339If a more complex sequence is needed to set the tabs than can be
1340described by this, the sequence can be placed in
1341.B is
1342or
1343.BR if .
1344.br
1345.ne 5
1346.PP
1347.B Delays
1348.PP
1349Certain capabilities control padding in the terminal driver.
1350These are primarily needed by hardcopy terminals and are used by the
1351.I tset\^
1352program to set terminal driver modes appropriately.
1353Delays embedded in the capabilities
1354.BR cr ,
1355.BR sf ,
1356.BR le ,
1357.BR ff ,
1358and
1359.B ta
1360will cause the appropriate delay bits to be set in the terminal driver.
1361If
1362.B pb
1363(padding baud rate) is given, these values can be ignored at baud rates
1364below the value of
1365.BR pb .
1366For 4.2BSD
1367.IR tset\^ ,
1368the delays are given as numeric capabilities
1369.BR dC ,
1370.BR dN ,
1371.BR dB ,
1372.BR dF ,
1373and
1374.BR dT
1375instead.
1376.br
1377.ne 5
c4737001
KM
1378.PP
1379.B Miscellaneous
1380.PP
ef978bfe
JB
1381If the terminal requires other than a \s-2NUL\s0 (zero) character as a pad,
1382this can be given as
1383.BR pc .
1384Only the first character of the
1385.B pc
1386string is used.
1387.PP
1388If the terminal has commands to save and restore the position of the
1389cursor, give them as
1390.B sc
1391and
1392.BR rc .
1393.PP
1394If the terminal has an extra \*(lqstatus line\*(rq that is not normally used by
1395software, this fact can be indicated.
1396If the status line is viewed as an extra line below the bottom line,
1397then the capability
1398.B hs
1399should be given.
1400Special strings to go to a position in the status line and to return
1401from the status line can be given as
1402.B ts
1403and
1404.BR fs .
1405.RB ( fs
1406must leave the cursor position in the same place that it was before
1407.BR ts .
1408If necessary, the
1409.B sc
1410and
1411.B rc
1412strings can be included in
1413.B ts
1414and
1415.B fs
1416to get this effect.)
1417The capability
1418.B ts
1419takes one parameter, which is the column number of the status line
1420to which the cursor is to be moved.
1421If escape sequences and other special commands such as tab work while in
1422the status line, the flag
1423.B es
1424can be given.
1425A string that turns off the status line (or otherwise erases its contents)
1426should be given as
1427.BR ds .
1428The status line is normally assumed to be the same width as the
1429rest of the screen,
1430.IR i.e. ,
1431.BR co .
1432If the status line is a different width (possibly because the terminal
1433does not allow an entire line to be loaded), then its width in columns
1434can be indicated with the numeric parameter
1435.BR ws .
1436.PP
1437If the terminal can move up or down half a line, this can be
1438indicated with
1439.B hu
1440(half-line up) and
1441.B hd
1442(half-line down).
1443This is primarily useful for superscripts and subscripts on hardcopy
1444terminals.
1445If a hardcopy terminal can eject to the next page (form feed),
1446give this as
1447.B ff
1448(usually
1449.BR ^L ).
1450.PP
1451If there is a command to repeat a given character a given number of times
1452(to save time transmitting a large number of identical characters),
1453this can be indicated with the parameterized string
1454.BR rp .
1455The first parameter is the character to be repeated and the second is
1456the number of times to repeat it.
1457(This is a
1458.I terminfo\^
1459feature that is unlikely to be supported by a program that uses
1460.IR termcap\^ .)
1461.PP
1462If the terminal has a settable command character, such as the
1463Tektronix 4025, this can be indicated with
1464.BR CC .
1465A prototype command character is chosen which is used in all capabilities.
1466This character is given in the
1467.B CC
1468capability to identify it.
1469The following convention is supported on some UNIX systems:
1470The environment is to be searched for a
1471.B
1472.SM CC
1473variable,
1474and if found,
1475all occurrences of the prototype character are replaced by the character
1476in the environment variable.
1477This use of the
1478.B
1479.SM CC
1480environment variable
1481is a very bad idea, as it conflicts with
1482.IR make\^ (1).
1483.PP
1484Terminal descriptions that do not represent a specific kind of known
1485terminal, such as
1486.IR switch\^ ,
1487.IR dialup\^ ,
1488.IR patch\^ ,
1489and
1490.IR network\^ ,
1491should include the
1492.B gn
1493(generic) capability so that programs can complain that they do not know
1494how to talk to the terminal.
1495(This capability does not apply to
1496.I virtual\^
1497terminal descriptions for which the escape sequences are known.)
1498.PP
1499If the terminal uses xoff/xon (\s-2DC3\s0/\s-2DC1\s0)
1500handshaking for flow control, give
1501.BR xo .
1502Padding information should still be included so that routines can make
1503better decisions about costs, but actual pad characters will not be
1504transmitted.
1505.PP
1506If the terminal has a \*(lqmeta key\*(rq which acts as a shift key, setting the
15078th bit of any character transmitted, then this fact can be indicated with
1508.BR km .
1509Otherwise, software will assume that the 8th bit is parity and it will
1510usually be cleared.
1511If strings exist to turn this \*(lqmeta mode\*(rq on and off, they can be given as
1512.B mm
1513and
1514.BR mo .
1515.PP
1516If the terminal has more lines of memory than will fit on the screen at once,
1517the number of lines of memory can be indicated with
1518.BR lm .
1519An explicit value of 0 indicates that the number of lines is not fixed,
1520but that there is still more memory than fits on the screen.
1521.PP
1522If the terminal is one of those supported by the UNIX system virtual
1523terminal protocol, the terminal number can be given as
1524.BR vt .
1525.PP
1526Media copy strings which control an auxiliary printer
1527connected to the terminal can be given as
1528.BR ps :
1529print the contents of the screen;
1530.BR pf :
1531turn off the printer; and
1532.BR po :
1533turn on the printer.
1534When the printer is on, all text sent to the terminal will be sent to the
1535printer.
1536It is undefined whether the text is also displayed on the terminal screen
1537when the printer is on.
1538A variation
1539.B pO
1540takes one parameter and leaves the printer on for as many characters as the
1541value of the parameter, then turns the printer off.
1542The parameter should not exceed 255.
1543All text, including
1544.BR pf ,
1545is transparently passed to the printer while
1546.B pO
1547is in effect.
1548.PP
1549Strings to program function keys can be given as
1550.BR pk ,
1551.BR pl ,
1552and
1553.BR px .
1554Each of these strings takes two parameters: the function key number
1555to program (from 0 to 9) and the string to program it with.
1556Function key numbers out of this range may program undefined keys
1557in a terminal-dependent manner.
1558The differences among the capabilities are that
1559.B pk
1560causes pressing the given key to be the same as the user typing the given
1561string;
1562.B pl
1563causes the string to be executed by the terminal in local mode;
1564and
1565.B px
1566causes the string to be transmitted to the computer.
1567Unfortunately, due to lack of a definition for string parameters in
1568.IR termcap\^ ,
1569only
1570.I terminfo\^
1571supports these capabilities.
1572.br
1573.ne 5
1574.PP
1575.B Glitches and Braindamage
1576.PP
1577Hazeltine terminals, which do not allow `~' characters to be displayed,
1578should indicate
1579.BR hz .
1580.PP
1581The
1582.B nc
1583capability, now obsolete, formerly indicated Datamedia terminals,
1584which echo
1585.B \er \en
1586for
1587carriage return then ignore a following linefeed.
1588.PP
1589Terminals that ignore a linefeed immediately after an
1590.B am
1591wrap, such as the Concept, should indicate
1592.BR xn .
1593.PP
1594If
1595.B ce
1596is required to get rid of standout
1597(instead of merely writing normal text on top of it),
1598.B xs
1599should be given.
1600.PP
c4737001 1601Teleray terminals, where tabs turn all characters moved over to blanks,
ef978bfe
JB
1602should indicate
1603.B xt
1604(destructive tabs).
1605This glitch is also taken to mean that it is not possible
1606to position the cursor on top of a \*(lqmagic cookie\*(rq, and that
1607to erase standout mode it is necessary to use delete and insert line.
c4737001 1608.PP
ef978bfe
JB
1609The Beehive Superbee, which is unable to correctly transmit the
1610\s-2ESC\s0 or ^C characters, has
1611.BR xb ,
1612indicating that the \*(lqf1\*(rq key is used for \s-2ESC\s0 and \*(lqf2\*(rq for ^C.
1613(Only certain Superbees have this problem, depending on the ROM.)
1614.PP
1615Other specific terminal problems may be corrected by adding more
1616capabilities of the form \fBx\fIx\^\fP.
1617.br
1618.ne 5
c4737001
KM
1619.PP
1620.B Similar Terminals
1621.PP
1622If there are two very similar terminals,
1623one can be defined as being just like the other with certain exceptions.
ef978bfe
JB
1624The string capability
1625.B tc
1626can be given
c4737001 1627with the name of the similar terminal.
ef978bfe
JB
1628This capability must be
1629.IR last\^ ,
1630and the combined length of the entries
1631must not exceed 1024.
1632The capabilities given before
1633.B tc
1634override those in the terminal type invoked by
1635.BR tc .
1636A capability can be canceled by placing
1637.B xx@
1638to the left of the
1639.B tc
1640invocation, where
1641.I xx\^
1642is the capability.
c4737001
KM
1643For example, the entry
1644.PP
ef978bfe 1645 hn\||\|2621\-nl:ks@:ke@:tc=2621:
c4737001 1646.PP
ef978bfe
JB
1647defines a \*(lq2621\-nl\*(rq that does not have the
1648.B ks
1649or
1650.B ke
1651capabilities,
1652hence does not turn on the function key labels when in visual mode.
c4737001
KM
1653This is useful for different modes for a terminal, or for different
1654user preferences.
c4737001
KM
1655.SH AUTHOR
1656William Joy
1657.br
1658Mark Horton added underlining and keypad support
ef978bfe
JB
1659.SH FILES
1660.DT
1661/etc/termcap file containing terminal descriptions
1662.SH SEE ALSO
1e1561a8
JK
1663ex(1), more(1), tset(1), ul(1), vi(1), curses(3X), printf(3S),
1664termcap(3X), term(7)
ef978bfe
JB
1665.SH "CAVEATS AND BUGS"
1666.B Note:
1667.I termcap\^
1668was replaced by
1669.I terminfo\^
1670in UNIX System V Release 2.0.
1671The transition will be relatively painless if capabilities flagged as
1672\*(lqobsolete\*(rq are avoided.
1673.PP
f3531ae0
JB
1674Lines and columns are now stored by the kernel as well as in the termcap
1675entry.
1676Most programs now use the kernel information primarily; the information
1677in this file is used only if the kernel does not have any information.
1678.PP
ef978bfe 1679.I Vi\^
c4737001
KM
1680allows only 256 characters for string capabilities, and the routines
1681in
ef978bfe 1682.IR termlib\^ (3)
c4737001
KM
1683do not check for overflow of this buffer.
1684The total length of a single entry (excluding only escaped newlines)
1685may not exceed 1024.
1686.PP
c4737001 1687Not all programs support all entries.