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