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