blob: bd8568f8e00dca2721cb17da97d08eb201ee48d0 [file] [log] [blame]
Steve Kondikae271bc2015-11-15 02:50:53 +01001.\" $Id: terminfo.tail,v 1.69 2015/04/26 14:47:23 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05302.\" Beginning of terminfo.tail file
3.\" This file is part of ncurses.
4.\" See "terminfo.head" for copyright.
5.ps +1
Steve Kondikae271bc2015-11-15 02:50:53 +01006.SS User-Defined Capabilities
7.
8The preceding section listed the \fIpredefined\fP capabilities.
9They deal with some special features for terminals no longer
10(or possibly never) produced.
11Occasionally there are special features of newer terminals which
12are awkward or impossible to represent by reusing the predefined
13capabilities.
14.PP
15\fBncurses\fP addresses this limitation by allowing user-defined capabilities.
16The \fB@TIC@\fP and \fB@INFOCMP@\fP programs provide
17the \fB\-x\fP option for this purpose.
18When \fB\-x\fP is set,
19\fB@TIC@\fP treats unknown capabilities as user-defined.
20That is, if \fB@TIC@\fP encounters a capability name
21which it does not recognize,
22it infers its type (boolean, number or string) from the syntax
23and makes an extended table entry for that capability.
24The \fBuse_extended_names\fP function makes this information
25conditionally available to applications.
26The ncurses library provides the data leaving most of the behavior
27to applications:
28.bP
29User-defined capability strings whose name begins
30with \*(``k\*('' are treated as function keys.
31.bP
32The types (boolean, number, string) determined by \fB@TIC@\fP
33can be inferred by successful calls on \fBtigetflag\fP, etc.
34.bP
35If the capability name happens to be two characters,
36the capability is also available through the termcap interface.
37.PP
38While termcap is said to be extensible because it does not use a predefined set
39of capabilities,
40in practice it has been limited to the capabilities defined by
41terminfo implementations.
42As a rule,
43user-defined capabilities intended for use by termcap applications should
44be limited to booleans and numbers to avoid running past the 1023 byte
45limit assumed by termcap implementations and their applications.
46In particular, providing extended sets of function keys (past the 60
47numbered keys and the handful of special named keys) is best done using
48the longer names available using terminfo.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053049.
50.SS A Sample Entry
51.
52The following entry, describing an ANSI-standard terminal, is representative
53of what a \fBterminfo\fR entry for a modern terminal typically looks like.
54.PP
55.nf
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053056.ft CW
57\s-2ansi|ansi/pc-term compatible with color,
Steve Kondikae271bc2015-11-15 02:50:53 +010058 am, mc5i, mir, msgr,
59 colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,
60 acsc=+\\020\\,\\021-\\030.^Y0\\333`\\004a\\261f\\370g\\361h\\260
61 j\\331k\\277l\\332m\\300n\\305o~p\\304q\\304r\\304s_t\\303
62 u\\264v\\301w\\302x\\263y\\363z\\362{\\343|\\330}\\234~\\376,
63 bel=^G, blink=\\E[5m, bold=\\E[1m, cbt=\\E[Z, clear=\\E[H\\E[J,
64 cr=^M, cub=\\E[%p1%dD, cub1=\\E[D, cud=\\E[%p1%dB, cud1=\\E[B,
65 cuf=\\E[%p1%dC, cuf1=\\E[C, cup=\\E[%i%p1%d;%p2%dH,
66 cuu=\\E[%p1%dA, cuu1=\\E[A, dch=\\E[%p1%dP, dch1=\\E[P,
67 dl=\\E[%p1%dM, dl1=\\E[M, ech=\\E[%p1%dX, ed=\\E[J, el=\\E[K,
68 el1=\\E[1K, home=\\E[H, hpa=\\E[%i%p1%dG, ht=\\E[I, hts=\\EH,
69 ich=\\E[%p1%d@, il=\\E[%p1%dL, il1=\\E[L, ind=^J,
70 indn=\\E[%p1%dS, invis=\\E[8m, kbs=^H, kcbt=\\E[Z, kcub1=\\E[D,
71 kcud1=\\E[B, kcuf1=\\E[C, kcuu1=\\E[A, khome=\\E[H, kich1=\\E[L,
72 mc4=\\E[4i, mc5=\\E[5i, nel=\\r\\E[S, op=\\E[39;49m,
73 rep=%p1%c\\E[%p2%{1}%-%db, rev=\\E[7m, rin=\\E[%p1%dT,
74 rmacs=\\E[10m, rmpch=\\E[10m, rmso=\\E[m, rmul=\\E[m,
75 s0ds=\\E(B, s1ds=\\E)B, s2ds=\\E*B, s3ds=\\E+B,
76 setab=\\E[4%p1%dm, setaf=\\E[3%p1%dm,
77 sgr=\\E[0;10%?%p1%t;7%;
78 %?%p2%t;4%;
79 %?%p3%t;7%;
80 %?%p4%t;5%;
81 %?%p6%t;1%;
82 %?%p7%t;8%;
83 %?%p9%t;11%;m,
84 sgr0=\\E[0;10m, smacs=\\E[11m, smpch=\\E[11m, smso=\\E[7m,
85 smul=\\E[4m, tbc=\\E[3g, u6=\\E[%i%d;%dR, u7=\\E[6n,
86 u8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%i%p1%dd,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053087.fi
88.ft R
89.PP
90Entries may continue onto multiple lines by placing white space at
91the beginning of each line except the first.
Steve Kondikae271bc2015-11-15 02:50:53 +010092Comments may be included on lines beginning with \*(``#\*(''.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053093Capabilities in
94.I terminfo
95are of three types:
Steve Kondikae271bc2015-11-15 02:50:53 +010096.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053097Boolean capabilities which indicate that the terminal has
Steve Kondikae271bc2015-11-15 02:50:53 +010098some particular feature,
99.bP
100numeric capabilities giving the size of the terminal
101or the size of particular delays, and
102.bP
103string
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530104capabilities, which give a sequence which can be used to perform particular
105terminal operations.
106.PP
107.SS Types of Capabilities
108.PP
109All capabilities have names.
110For instance, the fact that
111ANSI-standard terminals have
112.I "automatic margins"
113(i.e., an automatic return and line-feed
114when the end of a line is reached) is indicated by the capability \fBam\fR.
115Hence the description of ansi includes \fBam\fR.
Steve Kondikae271bc2015-11-15 02:50:53 +0100116Numeric capabilities are followed by the character \*(``#\*('' and then a positive value.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530117Thus \fBcols\fR, which indicates the number of columns the terminal has,
Steve Kondikae271bc2015-11-15 02:50:53 +0100118gives the value \*(``80\*('' for ansi.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530119Values for numeric capabilities may be specified in decimal, octal or hexadecimal,
120using the C programming language conventions (e.g., 255, 0377 and 0xff or 0xFF).
121.PP
122Finally, string valued capabilities, such as \fBel\fR (clear to end of line
Steve Kondikae271bc2015-11-15 02:50:53 +0100123sequence) are given by the two-character code, an \*(``=\*('', and then a string
124ending at the next following \*(``,\*(''.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530125.PP
126A number of escape sequences are provided in the string valued capabilities
127for easy encoding of characters there.
128Both \fB\eE\fR and \fB\ee\fR
129map to an \s-1ESCAPE\s0 character,
130\fB^x\fR maps to a control-x for any appropriate x, and the sequences
131\fB\en \el \er \et \eb \ef \es\fR give
132a newline, line-feed, return, tab, backspace, form-feed, and space.
Steve Kondikae271bc2015-11-15 02:50:53 +0100133Other escapes include
134.bP
135\fB\e^\fR for \fB^\fR,
136.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530137\fB\e\e\fR for \fB\e\fR,
Steve Kondikae271bc2015-11-15 02:50:53 +0100138.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530139\fB\e\fR, for comma,
Steve Kondikae271bc2015-11-15 02:50:53 +0100140.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530141\fB\e:\fR for \fB:\fR,
Steve Kondikae271bc2015-11-15 02:50:53 +0100142.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530143and \fB\e0\fR for null.
Steve Kondikae271bc2015-11-15 02:50:53 +0100144.IP
145\fB\e0\fR will produce \e200, which does not terminate a string but behaves
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530146as a null character on most terminals, providing CS7 is specified.
Steve Kondikae271bc2015-11-15 02:50:53 +0100147See stty(1).
148.IP
149The reason for this quirk is to maintain binary compatibility of the
150compiled terminfo files with other implementations,
151e.g., the SVr4 systems, which document this.
152Compiled terminfo files use null-terminated strings, with no lengths.
153Modifying this would require a new binary format,
154which would not work with other implementations.
155.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530156Finally, characters may be given as three octal digits after a \fB\e\fR.
157.PP
158A delay in milliseconds may appear anywhere in a string capability, enclosed in
159$<..> brackets, as in \fBel\fP=\eEK$<5>, and padding characters are supplied by
160.I tputs
161to provide this delay.
162The delay must be a number with at most one decimal
Steve Kondikae271bc2015-11-15 02:50:53 +0100163place of precision; it may be followed by suffixes \*(``*\*('' or \*(``/\*('' or both.
164A \*(``*\*(''
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530165indicates that the padding required is proportional to the number of lines
166affected by the operation, and the amount given is the per-affected-unit
167padding required.
168(In the case of insert character, the factor is still the
169number of
170.IR lines
171affected.) Normally, padding is advisory if the device has the \fBxon\fR
172capability; it is used for cost computation but does not trigger delays.
Steve Kondikae271bc2015-11-15 02:50:53 +0100173A \*(``/\*(''
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530174suffix indicates that the padding is mandatory and forces a delay of the given
175number of milliseconds even on devices for which \fBxon\fR is present to
176indicate flow control.
177.PP
178Sometimes individual capabilities must be commented out.
179To do this, put a period before the capability name.
180For example, see the second
181.B ind
182in the example above.
183.br
184.ne 5
185.PP
186.SS Fetching Compiled Descriptions
187.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100188The \fBncurses\fP library searches for terminal descriptions in several places.
189It uses only the first description found.
190The library has a compiled-in list of places to search
191which can be overridden by environment variables.
192Before starting to search,
193\fBncurses\fP eliminates duplicates in its search list.
194.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530195If the environment variable TERMINFO is set, it is interpreted as the pathname
196of a directory containing the compiled description you are working on.
Steve Kondikae271bc2015-11-15 02:50:53 +0100197Only that directory is searched.
198.bP
199If TERMINFO is not set,
200\fBncurses\fR will instead look in the directory \fB$HOME/.terminfo\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530201for a compiled description.
Steve Kondikae271bc2015-11-15 02:50:53 +0100202.bP
203Next, if the environment variable TERMINFO_DIRS is set,
204\fBncurses\fR will interpret the contents of that variable
205as a list of colon-separated directories (or database files) to be searched.
206.IP
207An empty directory name (i.e., if the variable begins or ends
208with a colon, or contains adjacent colons)
209is interpreted as the system location \fI\*d\fR.
210.bP
211Finally, \fBncurses\fP searches these compiled-in locations:
212.RS
213.bP
214a list of directories (@TERMINFO_DIRS@), and
215.bP
216the system terminfo directory, \fI\*d\fR (the compiled-in default).
217.RE
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530218.SS Preparing Descriptions
219.PP
220We now outline how to prepare descriptions of terminals.
221The most effective way to prepare a terminal description is by imitating
222the description of a similar terminal in
223.I terminfo
224and to build up a description gradually, using partial descriptions
225with
226.I vi
227or some other screen-oriented program to check that they are correct.
228Be aware that a very unusual terminal may expose deficiencies in
229the ability of the
230.I terminfo
231file to describe it
232or bugs in the screen-handling code of the test program.
233.PP
234To get the padding for insert line right (if the terminal manufacturer
235did not document it) a severe test is to edit a large file at 9600 baud,
Steve Kondikae271bc2015-11-15 02:50:53 +0100236delete 16 or so lines from the middle of the screen, then hit the \*(``u\*(''
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530237key several times quickly.
238If the terminal messes up, more padding is usually needed.
239A similar test can be used for insert character.
240.PP
241.SS Basic Capabilities
242.PP
243The number of columns on each line for the terminal is given by the
244\fBcols\fR numeric capability.
245If the terminal is a \s-1CRT\s0, then the
246number of lines on the screen is given by the \fBlines\fR capability.
247If the terminal wraps around to the beginning of the next line when
248it reaches the right margin, then it should have the \fBam\fR capability.
249If the terminal can clear its screen, leaving the cursor in the home
250position, then this is given by the \fBclear\fR string capability.
251If the terminal overstrikes
252(rather than clearing a position when a character is struck over)
253then it should have the \fBos\fR capability.
254If the terminal is a printing terminal, with no soft copy unit,
255give it both
256.B hc
257and
258.BR os .
259.RB ( os
260applies to storage scope terminals, such as \s-1TEKTRONIX\s+1 4010
261series, as well as hard copy and APL terminals.)
262If there is a code to move the cursor to the left edge of the current
263row, give this as
264.BR cr .
265(Normally this will be carriage return, control M.)
266If there is a code to produce an audible signal (bell, beep, etc)
267give this as
268.BR bel .
269.PP
270If there is a code to move the cursor one position to the left
271(such as backspace) that capability should be given as
272.BR cub1 .
273Similarly, codes to move to the right, up, and down should be
274given as
275.BR cuf1 ,
276.BR cuu1 ,
277and
278.BR cud1 .
279These local cursor motions should not alter the text they pass over,
Steve Kondikae271bc2015-11-15 02:50:53 +0100280for example, you would not normally use \*(``\fBcuf1\fP=\ \*('' because the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530281space would erase the character moved over.
282.PP
283A very important point here is that the local cursor motions encoded
284in
285.I terminfo
286are undefined at the left and top edges of a \s-1CRT\s0 terminal.
287Programs should never attempt to backspace around the left edge,
288unless
289.B bw
290is given,
291and never attempt to go up locally off the top.
292In order to scroll text up, a program will go to the bottom left corner
293of the screen and send the
294.B ind
295(index) string.
296.PP
297To scroll text down, a program goes to the top left corner
298of the screen and sends the
299.B ri
300(reverse index) string.
301The strings
302.B ind
303and
304.B ri
305are undefined when not on their respective corners of the screen.
306.PP
307Parameterized versions of the scrolling sequences are
308.B indn
309and
310.B rin
311which have the same semantics as
312.B ind
313and
314.B ri
315except that they take one parameter, and scroll that many lines.
316They are also undefined except at the appropriate edge of the screen.
317.PP
318The \fBam\fR capability tells whether the cursor sticks at the right
319edge of the screen when text is output, but this does not necessarily
320apply to a
321.B cuf1
322from the last column.
323The only local motion which is defined from the left edge is if
324.B bw
325is given, then a
326.B cub1
327from the left edge will move to the right edge of the previous row.
328If
329.B bw
330is not given, the effect is undefined.
331This is useful for drawing a box around the edge of the screen, for example.
332If the terminal has switch selectable automatic margins,
333the
334.I terminfo
335file usually assumes that this is on; i.e., \fBam\fR.
336If the terminal has a command which moves to the first column of the next
337line, that command can be given as
338.B nel
339(newline).
340It does not matter if the command clears the remainder of the current line,
341so if the terminal has no
342.B cr
343and
344.B lf
345it may still be possible to craft a working
346.B nel
347out of one or both of them.
348.PP
349These capabilities suffice to describe hard-copy and \*(lqglass-tty\*(rq terminals.
350Thus the model 33 teletype is described as
351.PP
352.DT
353.nf
354.ft CW
355.\".in -2
356\s-133\||\|tty33\||\|tty\||\|model 33 teletype,
Steve Kondikae271bc2015-11-15 02:50:53 +0100357 bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530358.\".in +2
359.ft R
Steve Kondikae271bc2015-11-15 02:50:53 +0100360.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530361.PP
362while the Lear Siegler \s-1ADM-3\s0 is described as
363.PP
364.DT
365.nf
366.ft CW
367.\".in -2
368\s-1adm3\||\|3\||\|lsi adm3,
Steve Kondikae271bc2015-11-15 02:50:53 +0100369 am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
370 ind=^J, lines#24,\s+1
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530371.\".in +2
372.ft R
373.fi
374.PP
375.SS Parameterized Strings
376.PP
377Cursor addressing and other strings requiring parameters
378in the terminal are described by a
Steve Kondikae271bc2015-11-15 02:50:53 +0100379parameterized string capability,
380with \fIprintf\fP-like escapes such as \fI%x\fR in it.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530381For example, to address the cursor, the
382.B cup
383capability is given, using two parameters:
384the row and column to address to.
385(Rows and columns are numbered from zero and refer to the
386physical screen visible to the user, not to any unseen memory.)
387If the terminal has memory relative cursor addressing,
388that can be indicated by
389.BR mrcup .
390.PP
391The parameter mechanism uses a stack and special \fB%\fP codes
392to manipulate it.
393Typically a sequence will push one of the
394parameters onto the stack and then print it in some format.
395Print (e.g., "%d") is a special case.
396Other operations, including "%t" pop their operand from the stack.
397It is noted that more complex operations are often necessary,
398e.g., in the \fBsgr\fP string.
399.PP
400The \fB%\fR encodings have the following meanings:
401.PP
402.TP 5
Steve Kondikae271bc2015-11-15 02:50:53 +0100403\fB%%\fP
404outputs \*(``%\*(''
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530405.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100406\fB%\fP\fI[[\fP:\fI]flags][width[.precision]][\fP\fBdoxXs\fP\fI]\fP
407as in \fBprintf\fP, flags are \fI[\-+#]\fP and \fIspace\fP.
408Use a \*(``:\*('' to allow the next character to be a \*(``\-\*('' flag,
409avoiding interpreting "%\-" as an operator.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530410.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100411\f(CW%c\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530412print pop() like %c in \fBprintf\fP
413.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100414\fB%s\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530415print pop() like %s in \fBprintf\fP
416.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100417\fB%p\fP\fI[1\-9]\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530418push \fIi\fP'th parameter
419.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100420\fB%P\fP\fI[a\-z]\fP
421set dynamic variable \fI[a\-z]\fP to pop()
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530422.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100423\fB%g\fP\fI[a\-z]/\fP
424get dynamic variable \fI[a\-z]\fP and push it
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530425.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100426\fB%P\fP\fI[A\-Z]\fP
427set static variable \fI[a\-z]\fP to \fIpop()\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530428.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100429\fB%g\fP\fI[A\-Z]\fP
430get static variable \fI[a\-z]\fP and push it
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530431.IP
432The terms "static" and "dynamic" are misleading.
433Historically, these are simply two different sets of variables,
434whose values are not reset between calls to \fBtparm\fP.
435However, that fact is not documented in other implementations.
436Relying on it will adversely impact portability to other implementations.
437.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100438\fB%'\fP\fIc\fP\fB'\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530439char constant \fIc\fP
440.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100441\fB%{\fP\fInn\fP\fB}\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530442integer constant \fInn\fP
443.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100444\fB%l\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530445push strlen(pop)
446.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100447\fB%+\fP, \fB%\-\fP, \fB%*\fP, \fB%/\fP, \fB%m\fP
448arithmetic (%m is mod): \fIpush(pop() op pop())\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530449.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100450\fB%&\fP, \fB%|\fP, \fB%^\fP
451bit operations (AND, OR and exclusive-OR): \fIpush(pop() op pop())\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530452.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100453\fB%=\fP, \fB%>\fP, \fB%<\fP
454logical operations: \fIpush(pop() op pop())\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530455.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100456\fB%A\fP, \fB%O\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530457logical AND and OR operations (for conditionals)
458.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100459\fB%!\fP, \fB%~\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530460unary operations (logical and bit complement): push(op pop())
461.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100462\fB%i\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530463add 1 to first two parameters (for ANSI terminals)
464.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100465\fB%?\fP \fIexpr\fP \fB%t\fP \fIthenpart\fP \fB%e\fP \fIelsepart\fP \fB%;\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530466This forms an if-then-else.
Steve Kondikae271bc2015-11-15 02:50:53 +0100467The \fB%e\fP \fIelsepart\fP is optional.
468Usually the \fB%?\fP \fIexpr\fP part pushes a value onto the stack,
469and \fB%t\fP pops it from the stack, testing if it is nonzero (true).
470If it is zero (false), control passes to the \fB%e\fP (else) part.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530471.IP
472It is possible to form else-if's a la Algol 68:
473.RS
Steve Kondikae271bc2015-11-15 02:50:53 +0100474\fB%?\fP c\d1\u \fB%t\fP b\d1\u \fB%e\fP c\d2\u \fB%t\fP b\d2\u \fB%e\fP c\d3\u \fB%t\fP b\d3\u \fB%e\fP c\d4\u \fB%t\fP b\d4\u \fB%e\fP \fB%;\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530475.RE
476.IP
477where c\di\u are conditions, b\di\u are bodies.
478.IP
Steve Kondikae271bc2015-11-15 02:50:53 +0100479Use the \fB\-f\fP option of \fB@TIC@\fP or \fB@INFOCMP@\fP to see
480the structure of if-then-else's.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530481Some strings, e.g., \fBsgr\fP can be very complicated when written
482on one line.
Steve Kondikae271bc2015-11-15 02:50:53 +0100483The \fB\-f\fP option splits the string into lines with the parts indented.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530484.PP
485Binary operations are in postfix form with the operands in the usual order.
Steve Kondikae271bc2015-11-15 02:50:53 +0100486That is, to get x\-5 one would use "%gx%{5}%-".
487\fB%P\fP and \fB%g\fP variables are
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530488persistent across escape-string evaluations.
489.PP
490Consider the HP2645, which, to get to row 3 and column 12, needs
491to be sent \eE&a12c03Y padded for 6 milliseconds.
492Note that the order
493of the rows and columns is inverted here, and that the row and column
494are printed as two digits.
495Thus its \fBcup\fR capability is \*(lqcup=6\eE&%p2%2dc%p1%2dY\*(rq.
496.PP
497The Microterm \s-1ACT-IV\s0 needs the current row and column sent
498preceded by a \fB^T\fR, with the row and column simply encoded in binary,
499\*(lqcup=^T%p1%c%p2%c\*(rq.
500Terminals which use \*(lq%c\*(rq need to be able to
501backspace the cursor (\fBcub1\fR),
502and to move the cursor up one line on the screen (\fBcuu1\fR).
503This is necessary because it is not always safe to transmit \fB\en\fR
504\fB^D\fR and \fB\er\fR, as the system may change or discard them.
505(The library routines dealing with terminfo set tty modes so that
506tabs are never expanded, so \et is safe to send.
507This turns out to be essential for the Ann Arbor 4080.)
508.PP
509A final example is the \s-1LSI ADM\s0-3a, which uses row and column
510offset by a blank character, thus \*(lqcup=\eE=%p1%' '%+%c%p2%' '%+%c\*(rq.
Steve Kondikae271bc2015-11-15 02:50:53 +0100511After sending \*(``\eE=\*('', this pushes the first parameter, pushes the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530512ASCII value for a space (32), adds them (pushing the sum on the stack
513in place of the two previous values) and outputs that value as a character.
514Then the same is done for the second parameter.
515More complex arithmetic is possible using the stack.
516.PP
517.SS Cursor Motions
518.PP
519If the terminal has a fast way to home the cursor
520(to very upper left corner of screen) then this can be given as
521\fBhome\fR; similarly a fast way of getting to the lower left-hand corner
522can be given as \fBll\fR; this may involve going up with \fBcuu1\fR
523from the home position,
524but a program should never do this itself (unless \fBll\fR does) because it
525can make no assumption about the effect of moving up from the home position.
526Note that the home position is the same as addressing to (0,0):
527to the top left corner of the screen, not of memory.
528(Thus, the \eEH sequence on HP terminals cannot be used for
529.BR home .)
530.PP
531If the terminal has row or column absolute cursor addressing,
532these can be given as single parameter capabilities
533.B hpa
534(horizontal position absolute)
535and
536.B vpa
537(vertical position absolute).
538Sometimes these are shorter than the more general two parameter
539sequence (as with the hp2645) and can be used in preference to
540.BR cup .
541If there are parameterized local motions (e.g., move
542.I n
543spaces to the right) these can be given as
544.BR cud ,
545.BR cub ,
546.BR cuf ,
547and
548.BR cuu
549with a single parameter indicating how many spaces to move.
550These are primarily useful if the terminal does not have
551.BR cup ,
552such as the \s-1TEKTRONIX\s+1 4025.
553.PP
554If the terminal needs to be in a special mode when running
555a program that uses these capabilities,
556the codes to enter and exit this mode can be given as \fBsmcup\fR and \fBrmcup\fR.
557This arises, for example, from terminals like the Concept with more than
558one page of memory.
559If the terminal has only memory relative cursor addressing and not screen
560relative cursor addressing, a one screen-sized window must be fixed into
561the terminal for cursor addressing to work properly.
562This is also used for the \s-1TEKTRONIX\s+1 4025,
563where
564.B smcup
565sets the command character to be the one used by terminfo.
566If the \fBsmcup\fP sequence will not restore the screen after an
567\fBrmcup\fP sequence is output (to the state prior to outputting
568\fBrmcup\fP), specify \fBnrrmc\fP.
569.PP
570.SS Area Clears
571.PP
572If the terminal can clear from the current position to the end of the
573line, leaving the cursor where it is, this should be given as \fBel\fR.
574If the terminal can clear from the beginning of the line to the current
575position inclusive, leaving
576the cursor where it is, this should be given as \fBel1\fP.
577If the terminal can clear from the current position to the end of the
578display, then this should be given as \fBed\fR.
579\fBEd\fR is only defined from the first column of a line.
580(Thus, it can be simulated by a request to delete a large number of lines,
581if a true
582.B ed
583is not available.)
584.PP
585.SS Insert/delete line and vertical motions
586.PP
587If the terminal can open a new blank line before the line where the cursor
588is, this should be given as \fBil1\fR; this is done only from the first
589position of a line.
590The cursor must then appear on the newly blank line.
591If the terminal can delete the line which the cursor is on, then this
592should be given as \fBdl1\fR; this is done only from the first position on
593the line to be deleted.
594Versions of
595.B il1
596and
597.B dl1
598which take a single parameter and insert or delete that many lines can
599be given as
600.B il
601and
602.BR dl .
603.PP
604If the terminal has a settable scrolling region (like the vt100)
605the command to set this can be described with the
606.B csr
607capability, which takes two parameters:
608the top and bottom lines of the scrolling region.
609The cursor position is, alas, undefined after using this command.
610.PP
611It is possible to get the effect of insert or delete line using
612.B csr
613on a properly chosen region; the
614.B sc
615and
616.B rc
617(save and restore cursor) commands may be useful for ensuring that
618your synthesized insert/delete string does not move the cursor.
619(Note that the \fBncurses\fR(3X) library does this synthesis
620automatically, so you need not compose insert/delete strings for
621an entry with \fBcsr\fR).
622.PP
623Yet another way to construct insert and delete might be to use a combination of
Steve Kondikae271bc2015-11-15 02:50:53 +0100624index with the memory-lock feature found on some terminals (like the HP\-700/90
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530625series, which however also has insert/delete).
626.PP
627Inserting lines at the top or bottom of the screen can also be
628done using
629.B ri
630or
631.B ind
632on many terminals without a true insert/delete line,
633and is often faster even on terminals with those features.
634.PP
635The boolean \fBnon_dest_scroll_region\fR should be set if each scrolling
636window is effectively a view port on a screen-sized canvas.
637To test for
638this capability, create a scrolling region in the middle of the screen,
639write something to the bottom line, move the cursor to the top of the region,
640and do \fBri\fR followed by \fBdl1\fR or \fBind\fR.
641If the data scrolled
642off the bottom of the region by the \fBri\fR re-appears, then scrolling
643is non-destructive.
644System V and XSI Curses expect that \fBind\fR, \fBri\fR,
645\fBindn\fR, and \fBrin\fR will simulate destructive scrolling; their
646documentation cautions you not to define \fBcsr\fR unless this is true.
647This \fBcurses\fR implementation is more liberal and will do explicit erases
648after scrolling if \fBndstr\fR is defined.
649.PP
650If the terminal has the ability to define a window as part of
651memory, which all commands affect,
652it should be given as the parameterized string
653.BR wind .
654The four parameters are the starting and ending lines in memory
655and the starting and ending columns in memory, in that order.
656.PP
657If the terminal can retain display memory above, then the
658\fBda\fR capability should be given; if display memory can be retained
659below, then \fBdb\fR should be given.
660These indicate
661that deleting a line or scrolling may bring non-blank lines up from below
662or that scrolling back with \fBri\fR may bring down non-blank lines.
663.PP
664.SS Insert/Delete Character
665.PP
666There are two basic kinds of intelligent terminals with respect to
667insert/delete character which can be described using
668.I terminfo.
669The most common insert/delete character operations affect only the characters
670on the current line and shift characters off the end of the line rigidly.
671Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make
672a distinction between typed and untyped blanks on the screen, shifting
673upon an insert or delete only to an untyped blank on the screen which is
674either eliminated, or expanded to two untyped blanks.
Steve Kondikae271bc2015-11-15 02:50:53 +0100675.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530676You can determine the
677kind of terminal you have by clearing the screen and then typing
678text separated by cursor motions.
679Type \*(lqabc\ \ \ \ def\*(rq using local
680cursor motions (not spaces) between the \*(lqabc\*(rq and the \*(lqdef\*(rq.
681Then position the cursor before the \*(lqabc\*(rq and put the terminal in insert
682mode.
683If typing characters causes the rest of the line to shift
684rigidly and characters to fall off the end, then your terminal does
685not distinguish between blanks and untyped positions.
686If the \*(lqabc\*(rq
687shifts over to the \*(lqdef\*(rq which then move together around the end of the
688current line and onto the next as you insert, you have the second type of
689terminal, and should give the capability \fBin\fR, which stands for
690\*(lqinsert null\*(rq.
Steve Kondikae271bc2015-11-15 02:50:53 +0100691.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530692While these are two logically separate attributes (one line versus multi-line
693insert mode, and special treatment of untyped spaces) we have seen no
694terminals whose insert mode cannot be described with the single attribute.
695.PP
696Terminfo can describe both terminals which have an insert mode, and terminals
697which send a simple sequence to open a blank position on the current line.
698Give as \fBsmir\fR the sequence to get into insert mode.
699Give as \fBrmir\fR the sequence to leave insert mode.
700Now give as \fBich1\fR any sequence needed to be sent just before sending
701the character to be inserted.
702Most terminals with a true insert mode
703will not give \fBich1\fR; terminals which send a sequence to open a screen
704position should give it here.
705.PP
706If your terminal has both, insert mode is usually preferable to \fBich1\fR.
707Technically, you should not give both unless the terminal actually requires
708both to be used in combination.
709Accordingly, some non-curses applications get
710confused if both are present; the symptom is doubled characters in an update
711using insert.
712This requirement is now rare; most \fBich\fR sequences do not
713require previous smir, and most smir insert modes do not require \fBich1\fR
714before each character.
715Therefore, the new \fBcurses\fR actually assumes this
716is the case and uses either \fBrmir\fR/\fBsmir\fR or \fBich\fR/\fBich1\fR as
717appropriate (but not both).
718If you have to write an entry to be used under
719new curses for a terminal old enough to need both, include the
720\fBrmir\fR/\fBsmir\fR sequences in \fBich1\fR.
721.PP
722If post insert padding is needed, give this as a number of milliseconds
723in \fBip\fR (a string option).
724Any other sequence which may need to be
725sent after an insert of a single character may also be given in \fBip\fR.
Steve Kondikae271bc2015-11-15 02:50:53 +0100726If your terminal needs both to be placed into an \*(``insert mode\*('' and
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530727a special code to precede each inserted character, then both
728.BR smir / rmir
729and
730.B ich1
731can be given, and both will be used.
732The
733.B ich
734capability, with one parameter,
735.IR n ,
736will repeat the effects of
737.B ich1
738.I n
739times.
740.PP
741If padding is necessary between characters typed while not
742in insert mode, give this as a number of milliseconds padding in \fBrmp\fP.
743.PP
744It is occasionally necessary to move around while in insert mode
745to delete characters on the same line (e.g., if there is a tab after
746the insertion position).
747If your terminal allows motion while in
748insert mode you can give the capability \fBmir\fR to speed up inserting
749in this case.
750Omitting \fBmir\fR will affect only speed.
751Some terminals
752(notably Datamedia's) must not have \fBmir\fR because of the way their
753insert mode works.
754.PP
755Finally, you can specify
756.B dch1
757to delete a single character,
758.B dch
759with one parameter,
760.IR n ,
761to delete
762.I n characters,
763and delete mode by giving \fBsmdc\fR and \fBrmdc\fR
764to enter and exit delete mode (any mode the terminal needs to be placed
765in for
766.B dch1
767to work).
768.PP
769A command to erase
770.I n
771characters (equivalent to outputting
772.I n
773blanks without moving the cursor)
774can be given as
775.B ech
776with one parameter.
777.PP
778.SS "Highlighting, Underlining, and Visible Bells"
779.PP
780If your terminal has one or more kinds of display attributes,
781these can be represented in a number of different ways.
782You should choose one display form as
783\f2standout mode\fR,
784representing a good, high contrast, easy-on-the-eyes,
785format for highlighting error messages and other attention getters.
786(If you have a choice, reverse video plus half-bright is good,
787or reverse video alone.)
788The sequences to enter and exit standout mode
789are given as \fBsmso\fR and \fBrmso\fR, respectively.
790If the code to change into or out of standout
791mode leaves one or even two blank spaces on the screen,
792as the TVI 912 and Teleray 1061 do,
793then \fBxmc\fR should be given to tell how many spaces are left.
794.PP
795Codes to begin underlining and end underlining can be given as \fBsmul\fR
796and \fBrmul\fR respectively.
797If the terminal has a code to underline the current character and move
798the cursor one space to the right,
799such as the Microterm Mime,
800this can be given as \fBuc\fR.
801.PP
802Other capabilities to enter various highlighting modes include
803.B blink
804(blinking)
805.B bold
806(bold or extra bright)
807.B dim
808(dim or half-bright)
809.B invis
810(blanking or invisible text)
811.B prot
812(protected)
813.B rev
814(reverse video)
815.B sgr0
816(turn off
817.I all
818attribute modes)
819.B smacs
820(enter alternate character set mode)
821and
822.B rmacs
823(exit alternate character set mode).
824Turning on any of these modes singly may or may not turn off other modes.
825.PP
826If there is a sequence to set arbitrary combinations of modes,
827this should be given as
828.B sgr
829(set attributes),
830taking 9 parameters.
831Each parameter is either 0 or nonzero, as the corresponding attribute is on or off.
832The 9 parameters are, in order:
833standout, underline, reverse, blink, dim, bold, blank, protect, alternate
834character set.
835Not all modes need be supported by
836.BR sgr ,
837only those for which corresponding separate attribute commands exist.
838.PP
839For example, the DEC vt220 supports most of the modes:
840.PP
841.TS
842center;
Steve Kondikae271bc2015-11-15 02:50:53 +0100843l l l
844l l l
845lw18 lw14 lw18.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530846\fBtparm parameter attribute escape sequence\fP
847
848none none \\E[0m
849p1 standout \\E[0;1;7m
850p2 underline \\E[0;4m
851p3 reverse \\E[0;7m
852p4 blink \\E[0;5m
853p5 dim not available
854p6 bold \\E[0;1m
855p7 invis \\E[0;8m
856p8 protect not used
857p9 altcharset ^O (off) ^N (on)
858.TE
859.PP
860We begin each escape sequence by turning off any existing modes, since
861there is no quick way to determine whether they are active.
862Standout is set up to be the combination of reverse and bold.
863The vt220 terminal has a protect mode,
864though it is not commonly used in sgr
865because it protects characters on the screen from the host's erasures.
866The altcharset mode also is different in that it is either ^O or ^N,
867depending on whether it is off or on.
868If all modes are turned on, the resulting sequence is \\E[0;1;4;5;7;8m^N.
869.PP
870Some sequences are common to different modes.
871For example, ;7 is output when either p1 or p3 is true, that is, if
872either standout or reverse modes are turned on.
873.PP
874Writing out the above sequences, along with their dependencies yields
875.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100876.ne 11
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530877.TS
878center;
Steve Kondikae271bc2015-11-15 02:50:53 +0100879l l l
880l l l
881lw18 lw14 lw18.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530882\fBsequence when to output terminfo translation\fP
883
Steve Kondikae271bc2015-11-15 02:50:53 +0100884.ft CW
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530885\\E[0 always \\E[0
886;1 if p1 or p6 %?%p1%p6%|%t;1%;
887;4 if p2 %?%p2%|%t;4%;
888;5 if p4 %?%p4%|%t;5%;
889;7 if p1 or p3 %?%p1%p3%|%t;7%;
890;8 if p7 %?%p7%|%t;8%;
891m always m
892^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%;
Steve Kondikae271bc2015-11-15 02:50:53 +0100893.ft R
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530894.TE
895.PP
896Putting this all together into the sgr sequence gives:
897.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100898.ft CW
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530899.nf
Steve Kondikae271bc2015-11-15 02:50:53 +0100900 sgr=\\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%;
901 %?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\\016%e\\017%;,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530902.fi
Steve Kondikae271bc2015-11-15 02:50:53 +0100903.ft R
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530904.PP
905Remember that if you specify sgr, you must also specify sgr0.
906Also, some implementations rely on sgr being given if sgr0 is,
907Not all terminfo entries necessarily have an sgr string, however.
908Many terminfo entries are derived from termcap entries
909which have no sgr string.
910The only drawback to adding an sgr string is that termcap also
911assumes that sgr0 does not exit alternate character set mode.
912.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100913Terminals with the \*(``magic cookie\*('' glitch
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530914.RB ( xmc )
Steve Kondikae271bc2015-11-15 02:50:53 +0100915deposit special \*(``cookies\*('' when they receive mode-setting sequences,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530916which affect the display algorithm rather than having extra bits for
917each character.
918Some terminals, such as the HP 2621, automatically leave standout
919mode when they move to a new line or the cursor is addressed.
920Programs using standout mode should exit standout mode before
921moving the cursor or sending a newline,
922unless the
923.B msgr
924capability, asserting that it is safe to move in standout mode, is present.
925.PP
926If the terminal has
927a way of flashing the screen to indicate an error quietly (a bell replacement)
928then this can be given as \fBflash\fR; it must not move the cursor.
929.PP
930If the cursor needs to be made more visible than normal when it is
931not on the bottom line (to make, for example, a non-blinking underline into an
932easier to find block or blinking underline)
933give this sequence as
934.BR cvvis .
935If there is a way to make the cursor completely invisible, give that as
936.BR civis .
937The capability
938.BR cnorm
939should be given which undoes the effects of both of these modes.
940.PP
941If your terminal correctly generates underlined characters
942(with no special codes needed)
943even though it does not overstrike,
944then you should give the capability \fBul\fR.
945If a character overstriking another leaves both characters on the screen,
946specify the capability \fBos\fP.
947If overstrikes are erasable with a blank,
948then this should be indicated by giving \fBeo\fR.
949.PP
950.SS Keypad and Function Keys
951.PP
952If the terminal has a keypad that transmits codes when the keys are pressed,
953this information can be given.
954Note that it is not possible to handle
955terminals where the keypad only works in local (this applies, for example,
956to the unshifted HP 2621 keys).
957If the keypad can be set to transmit or not transmit,
958give these codes as \fBsmkx\fR and \fBrmkx\fR.
959Otherwise the keypad is assumed to always transmit.
Steve Kondikae271bc2015-11-15 02:50:53 +0100960.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530961The codes sent by the left arrow, right arrow, up arrow, down arrow,
962and home keys can be given as
963\fBkcub1, kcuf1, kcuu1, kcud1, \fRand\fB khome\fR respectively.
964If there are function keys such as f0, f1, ..., f10, the codes they send
965can be given as \fBkf0, kf1, ..., kf10\fR.
966If these keys have labels other than the default f0 through f10, the labels
967can be given as \fBlf0, lf1, ..., lf10\fR.
Steve Kondikae271bc2015-11-15 02:50:53 +0100968.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530969The codes transmitted by certain other special keys can be given:
Steve Kondikae271bc2015-11-15 02:50:53 +0100970.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530971.B kll
972(home down),
Steve Kondikae271bc2015-11-15 02:50:53 +0100973.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530974.B kbs
975(backspace),
Steve Kondikae271bc2015-11-15 02:50:53 +0100976.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530977.B ktbc
978(clear all tabs),
Steve Kondikae271bc2015-11-15 02:50:53 +0100979.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530980.B kctab
981(clear the tab stop in this column),
Steve Kondikae271bc2015-11-15 02:50:53 +0100982.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530983.B kclr
984(clear screen or erase key),
Steve Kondikae271bc2015-11-15 02:50:53 +0100985.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530986.B kdch1
987(delete character),
Steve Kondikae271bc2015-11-15 02:50:53 +0100988.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530989.B kdl1
990(delete line),
Steve Kondikae271bc2015-11-15 02:50:53 +0100991.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530992.B krmir
993(exit insert mode),
Steve Kondikae271bc2015-11-15 02:50:53 +0100994.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530995.B kel
996(clear to end of line),
Steve Kondikae271bc2015-11-15 02:50:53 +0100997.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530998.B ked
999(clear to end of screen),
Steve Kondikae271bc2015-11-15 02:50:53 +01001000.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301001.B kich1
1002(insert character or enter insert mode),
Steve Kondikae271bc2015-11-15 02:50:53 +01001003.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301004.B kil1
1005(insert line),
Steve Kondikae271bc2015-11-15 02:50:53 +01001006.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301007.B knp
1008(next page),
Steve Kondikae271bc2015-11-15 02:50:53 +01001009.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301010.B kpp
1011(previous page),
Steve Kondikae271bc2015-11-15 02:50:53 +01001012.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301013.B kind
1014(scroll forward/down),
Steve Kondikae271bc2015-11-15 02:50:53 +01001015.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301016.B kri
1017(scroll backward/up),
Steve Kondikae271bc2015-11-15 02:50:53 +01001018.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301019.B khts
1020(set a tab stop in this column).
Steve Kondikae271bc2015-11-15 02:50:53 +01001021.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301022In addition, if the keypad has a 3 by 3 array of keys including the four
1023arrow keys, the other five keys can be given as
1024.BR ka1 ,
1025.BR ka3 ,
1026.BR kb2 ,
1027.BR kc1 ,
1028and
1029.BR kc3 .
1030These keys are useful when the effects of a 3 by 3 directional pad are needed.
1031.PP
1032Strings to program function keys can be given as
1033.BR pfkey ,
1034.BR pfloc ,
1035and
1036.BR pfx .
1037A string to program screen labels should be specified as \fBpln\fP.
1038Each of these strings takes two parameters: the function key number to
1039program (from 0 to 10) and the string to program it with.
1040Function key numbers out of this range may program undefined keys in
1041a terminal dependent manner.
1042The difference between the capabilities is that
1043.B pfkey
1044causes pressing the given key to be the same as the user typing the
1045given string;
1046.B pfloc
1047causes the string to be executed by the terminal in local; and
1048.B pfx
1049causes the string to be transmitted to the computer.
1050.PP
1051The capabilities \fBnlab\fP, \fBlw\fP and \fBlh\fP
1052define the number of programmable
1053screen labels and their width and height.
1054If there are commands to turn the labels on and off,
1055give them in \fBsmln\fP and \fBrmln\fP.
1056\fBsmln\fP is normally output after one or more pln
1057sequences to make sure that the change becomes visible.
1058.PP
1059.SS Tabs and Initialization
1060.PP
1061If the terminal has hardware tabs, the command to advance to the next
1062tab stop can be given as
1063.B ht
1064(usually control I).
Steve Kondikae271bc2015-11-15 02:50:53 +01001065A \*(``back-tab\*('' command which moves leftward to the preceding tab stop can
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301066be given as
1067.BR cbt .
1068By convention, if the teletype modes indicate that tabs are being
1069expanded by the computer rather than being sent to the terminal,
1070programs should not use
1071.B ht
1072or
1073.B cbt
1074even if they are present, since the user may not have the tab stops
1075properly set.
1076If the terminal has hardware tabs which are initially set every
1077.I n
1078spaces when the terminal is powered up,
1079the numeric parameter
1080.B it
1081is given, showing the number of spaces the tabs are set to.
1082This is normally used by the
Steve Kondikae271bc2015-11-15 02:50:53 +01001083.IR @TSET@
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301084command to determine whether to set the mode for hardware tab expansion,
1085and whether to set the tab stops.
1086If the terminal has tab stops that can be saved in non-volatile memory,
1087the terminfo description can assume that they are properly set.
1088.PP
1089Other capabilities
1090include
1091.BR is1 ,
1092.BR is2 ,
1093and
1094.BR is3 ,
1095initialization strings for the terminal,
1096.BR iprog ,
1097the path name of a program to be run to initialize the terminal,
1098and \fBif\fR, the name of a file containing long initialization strings.
1099These strings are expected to set the terminal into modes consistent
1100with the rest of the terminfo description.
1101They are normally sent to the terminal, by the
1102.I init
1103option of the
1104.IR @TPUT@
1105program, each time the user logs in.
1106They will be printed in the following order:
1107.RS
1108.TP
1109run the program
1110.BR iprog
1111.TP
1112output
1113.BR is1
1114.BR is2
1115.TP
1116set the margins using
1117.BR mgc ,
1118.BR smgl
1119and
1120.BR smgr
1121.TP
1122set tabs using
1123.B tbc
1124and
1125.BR hts
1126.TP
1127print the file
1128.BR if
1129.TP
1130and finally
1131output
1132.BR is3 .
1133.RE
1134.PP
1135Most initialization is done with
1136.BR is2 .
1137Special terminal modes can be set up without duplicating strings
1138by putting the common sequences in
1139.B is2
1140and special cases in
1141.B is1
1142and
1143.BR is3 .
1144.PP
1145A set of sequences that does a harder reset from a totally unknown state
1146can be given as
1147.BR rs1 ,
1148.BR rs2 ,
1149.BR rf
1150and
1151.BR rs3 ,
1152analogous to
1153.B is1 ,
1154.B is2 ,
1155.B if
1156and
1157.BR is3
1158respectively.
1159These strings are output by the
1160.IR reset
1161program, which is used when the terminal gets into a wedged state.
1162Commands are normally placed in
1163.BR rs1 ,
1164.BR rs2
1165.B rs3
1166and
1167.B rf
1168only if they produce annoying effects on the screen and are not
1169necessary when logging in.
1170For example, the command to set the vt100 into 80-column mode would
1171normally be part of
1172.BR is2 ,
1173but it causes an annoying glitch of the screen and is not normally
1174needed since the terminal is usually already in 80 column mode.
1175.PP
1176The
1177.IR reset
1178program writes strings
1179including
1180.BR iprog ,
1181etc., in the same order as the
1182.IR init
1183program, using
1184.BR rs1 ,
1185etc., instead of
1186.BR is1 ,
1187etc.
1188If any of
1189.BR rs1 ,
1190.BR rs2 ,
1191.BR rs3 ,
1192or
1193.BR rf
1194reset capability strings are missing, the
1195.IR reset
1196program falls back upon the corresponding initialization capability string.
1197.PP
1198If there are commands to set and clear tab stops, they can be given as
1199.B tbc
1200(clear all tab stops)
1201and
1202.B hts
1203(set a tab stop in the current column of every row).
1204If a more complex sequence is needed to set the tabs than can be
1205described by this, the sequence can be placed in
1206.B is2
1207or
1208.BR if .
1209.SS Delays and Padding
1210.PP
1211Many older and slower terminals do not support either XON/XOFF or DTR
1212handshaking, including hard copy terminals and some very archaic CRTs
1213(including, for example, DEC VT100s).
1214These may require padding characters
1215after certain cursor motions and screen changes.
1216.PP
1217If the terminal uses xon/xoff handshaking for flow control (that is,
1218it automatically emits ^S back to the host when its input buffers are
1219close to full), set
1220.BR xon .
1221This capability suppresses the emission of padding.
1222You can also set it
1223for memory-mapped console devices effectively that do not have a speed limit.
1224Padding information should still be included so that routines can
1225make better decisions about relative costs, but actual pad characters will
1226not be transmitted.
1227.PP
1228If \fBpb\fR (padding baud rate) is given, padding is suppressed at baud rates
1229below the value of \fBpb\fR.
1230If the entry has no padding baud rate, then
1231whether padding is emitted or not is completely controlled by \fBxon\fR.
1232.PP
1233If the terminal requires other than a null (zero) character as a pad,
1234then this can be given as \fBpad\fR.
1235Only the first character of the
1236.B pad
1237string is used.
1238.PP
1239.SS Status Lines
Steve Kondikae271bc2015-11-15 02:50:53 +01001240Some terminals have an extra \*(``status line\*('' which is not normally used by
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301241software (and thus not counted in the terminal's \fBlines\fR capability).
1242.PP
1243The simplest case is a status line which is cursor-addressable but not
1244part of the main scrolling region on the screen; the Heathkit H19 has
1245a status line of this kind, as would a 24-line VT100 with a 23-line
1246scrolling region set up on initialization.
1247This situation is indicated
1248by the \fBhs\fR capability.
1249.PP
1250Some terminals with status lines need special sequences to access the
1251status line.
1252These may be expressed as a string with single parameter
1253\fBtsl\fR which takes the cursor to a given zero-origin column on the
1254status line.
1255The capability \fBfsl\fR must return to the main-screen
1256cursor positions before the last \fBtsl\fR.
1257You may need to embed the
1258string values of \fBsc\fR (save cursor) and \fBrc\fR (restore cursor)
1259in \fBtsl\fR and \fBfsl\fR to accomplish this.
1260.PP
1261The status line is normally assumed to be the same width as the width
1262of the terminal.
1263If this is untrue, you can specify it with the numeric
1264capability \fBwsl\fR.
1265.PP
1266A command to erase or blank the status line may be specified as \fBdsl\fR.
1267.PP
1268The boolean capability \fBeslok\fR specifies that escape sequences, tabs,
1269etc., work ordinarily in the status line.
1270.PP
1271The \fBncurses\fR implementation does not yet use any of these capabilities.
1272They are documented here in case they ever become important.
1273.PP
1274.SS Line Graphics
1275.PP
1276Many terminals have alternate character sets useful for forms-drawing.
1277Terminfo and \fBcurses\fR build in support for the drawing characters
1278supported by the VT100, with some characters from the AT&T 4410v1 added.
1279This alternate character set may be specified by the \fBacsc\fR capability.
1280.PP
1281.TS H
1282center expand;
Steve Kondikae271bc2015-11-15 02:50:53 +01001283l l l l
1284l l l l
1285lw25 lw10 lw6 lw6.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301286.\".TH
1287\fBGlyph ACS Ascii VT100\fR
1288\fBName Name Default Name\fR
1289UK pound sign ACS_STERLING f }
1290arrow pointing down ACS_DARROW v .
1291arrow pointing left ACS_LARROW < ,
1292arrow pointing right ACS_RARROW > +
Steve Kondikae271bc2015-11-15 02:50:53 +01001293arrow pointing up ACS_UARROW ^ \-
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301294board of squares ACS_BOARD # h
1295bullet ACS_BULLET o ~
1296checker board (stipple) ACS_CKBOARD : a
1297degree symbol ACS_DEGREE \e f
1298diamond ACS_DIAMOND + `
1299greater-than-or-equal-to ACS_GEQUAL > z
1300greek pi ACS_PI * {
Steve Kondikae271bc2015-11-15 02:50:53 +01001301horizontal line ACS_HLINE \- q
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301302lantern symbol ACS_LANTERN # i
1303large plus or crossover ACS_PLUS + n
1304less-than-or-equal-to ACS_LEQUAL < y
1305lower left corner ACS_LLCORNER + m
1306lower right corner ACS_LRCORNER + j
1307not-equal ACS_NEQUAL ! |
1308plus/minus ACS_PLMINUS # g
1309scan line 1 ACS_S1 ~ o
Steve Kondikae271bc2015-11-15 02:50:53 +01001310scan line 3 ACS_S3 \- p
1311scan line 7 ACS_S7 \- r
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301312scan line 9 ACS_S9 \&_ s
1313solid square block ACS_BLOCK # 0
1314tee pointing down ACS_TTEE + w
1315tee pointing left ACS_RTEE + u
1316tee pointing right ACS_LTEE + t
1317tee pointing up ACS_BTEE + v
1318upper left corner ACS_ULCORNER + l
1319upper right corner ACS_URCORNER + k
1320vertical line ACS_VLINE | x
1321.TE
1322.PP
1323The best way to define a new device's graphics set is to add a column
1324to a copy of this table for your terminal, giving the character which
1325(when emitted between \fBsmacs\fR/\fBrmacs\fR switches) will be rendered
1326as the corresponding graphic.
1327Then read off the VT100/your terminal
1328character pairs right to left in sequence; these become the ACSC string.
1329.PP
1330.SS Color Handling
1331.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001332Most color terminals are either \*(``Tektronix-like\*('' or \*(``HP-like\*(''.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301333Tektronix-like
1334terminals have a predefined set of N colors (where N usually 8), and can set
1335character-cell foreground and background characters independently, mixing them
Steve Kondikae271bc2015-11-15 02:50:53 +01001336into N\ *\ N color-pairs.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301337On HP-like terminals, the use must set each color
1338pair up separately (foreground and background are not independently settable).
1339Up to M color-pairs may be set up from 2*M different colors.
1340ANSI-compatible
1341terminals are Tektronix-like.
1342.PP
1343Some basic color capabilities are independent of the color method.
1344The numeric
1345capabilities \fBcolors\fR and \fBpairs\fR specify the maximum numbers of colors
1346and color-pairs that can be displayed simultaneously.
1347The \fBop\fR (original
1348pair) string resets foreground and background colors to their default values
1349for the terminal.
1350The \fBoc\fR string resets all colors or color-pairs to
1351their default values for the terminal.
1352Some terminals (including many PC
1353terminal emulators) erase screen areas with the current background color rather
1354than the power-up default background; these should have the boolean capability
1355\fBbce\fR.
1356.PP
1357To change the current foreground or background color on a Tektronix-type
1358terminal, use \fBsetaf\fR (set ANSI foreground) and \fBsetab\fR (set ANSI
1359background) or \fBsetf\fR (set foreground) and \fBsetb\fR (set background).
1360These take one parameter, the color number.
1361The SVr4 documentation describes
1362only \fBsetaf\fR/\fBsetab\fR; the XPG4 draft says that "If the terminal
1363supports ANSI escape sequences to set background and foreground, they should
1364be coded as \fBsetaf\fR and \fBsetab\fR, respectively.
1365If the terminal
1366supports other escape sequences to set background and foreground, they should
1367be coded as \fBsetf\fR and \fBsetb\fR, respectively.
1368The \fIvidputs()\fR
1369function and the refresh functions use \fBsetaf\fR and \fBsetab\fR if they are
1370defined."
1371.PP
1372The \fBsetaf\fR/\fBsetab\fR and \fBsetf\fR/\fBsetb\fR capabilities take a
1373single numeric argument each.
1374Argument values 0-7 of \fBsetaf\fR/\fBsetab\fR are portably defined as
1375follows (the middle column is the symbolic #define available in the header for
1376the \fBcurses\fR or \fBncurses\fR libraries).
1377The terminal hardware is free to
1378map these as it likes, but the RGB values indicate normal locations in color
1379space.
1380.PP
1381.TS H
1382center;
1383l c c c
1384l l n l.
1385\fBColor #define Value RGB\fR
1386black \fBCOLOR_BLACK\fR 0 0, 0, 0
1387red \fBCOLOR_RED\ \fR 1 max,0,0
1388green \fBCOLOR_GREEN\fR 2 0,max,0
1389yellow \fBCOLOR_YELLOW\fR 3 max,max,0
1390blue \fBCOLOR_BLUE\fR 4 0,0,max
1391magenta \fBCOLOR_MAGENTA\fR 5 max,0,max
1392cyan \fBCOLOR_CYAN\fR 6 0,max,max
1393white \fBCOLOR_WHITE\fR 7 max,max,max
1394.TE
1395.PP
1396The argument values of \fBsetf\fR/\fBsetb\fR historically correspond to
1397a different mapping, i.e.,
1398.TS H
1399center;
1400l c c c
1401l l n l.
1402\fBColor #define Value RGB\fR
1403black \fBCOLOR_BLACK\fR 0 0, 0, 0
1404blue \fBCOLOR_BLUE\fR 1 0,0,max
1405green \fBCOLOR_GREEN\fR 2 0,max,0
1406cyan \fBCOLOR_CYAN\fR 3 0,max,max
1407red \fBCOLOR_RED\ \fR 4 max,0,0
1408magenta \fBCOLOR_MAGENTA\fR 5 max,0,max
1409yellow \fBCOLOR_YELLOW\fR 6 max,max,0
1410white \fBCOLOR_WHITE\fR 7 max,max,max
1411.TE
Steve Kondikae271bc2015-11-15 02:50:53 +01001412.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301413It is important to not confuse the two sets of color capabilities;
1414otherwise red/blue will be interchanged on the display.
1415.PP
1416On an HP-like terminal, use \fBscp\fR with a color-pair number parameter to set
1417which color pair is current.
1418.PP
1419On a Tektronix-like terminal, the capability \fBccc\fR may be present to
1420indicate that colors can be modified.
1421If so, the \fBinitc\fR capability will
Steve Kondikae271bc2015-11-15 02:50:53 +01001422take a color number (0 to \fBcolors\fR \- 1)and three more parameters which
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301423describe the color.
1424These three parameters default to being interpreted as RGB
1425(Red, Green, Blue) values.
1426If the boolean capability \fBhls\fR is present,
1427they are instead as HLS (Hue, Lightness, Saturation) indices.
1428The ranges are
1429terminal-dependent.
1430.PP
1431On an HP-like terminal, \fBinitp\fR may give a capability for changing a
1432color-pair value.
1433It will take seven parameters; a color-pair number (0 to
Steve Kondikae271bc2015-11-15 02:50:53 +01001434\fBmax_pairs\fR \- 1), and two triples describing first background and then
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301435foreground colors.
1436These parameters must be (Red, Green, Blue) or
1437(Hue, Lightness, Saturation) depending on \fBhls\fR.
1438.PP
1439On some color terminals, colors collide with highlights.
1440You can register
1441these collisions with the \fBncv\fR capability.
1442This is a bit-mask of
1443attributes not to be used when colors are enabled.
1444The correspondence with the
1445attributes understood by \fBcurses\fR is as follows:
1446.PP
1447.TS
1448center;
Steve Kondikae271bc2015-11-15 02:50:53 +01001449l l l l
1450lw20 lw2 lw10 lw10.
1451\fBAttribute Bit Decimal Set by\fR
1452A_STANDOUT 0 1 sgr
1453A_UNDERLINE 1 2 sgr
1454A_REVERSE 2 4 sgr
1455A_BLINK 3 8 sgr
1456A_DIM 4 16 sgr
1457A_BOLD 5 32 sgr
1458A_INVIS 6 64 sgr
1459A_PROTECT 7 128 sgr
1460A_ALTCHARSET 8 256 sgr
1461A_HORIZONTAL 9 512 sgr1
1462A_LEFT 10 1024 sgr1
1463A_LOW 11 2048 sgr1
1464A_RIGHT 12 4096 sgr1
1465A_TOP 13 8192 sgr1
1466A_VERTICAL 14 16384 sgr1
1467A_ITALIC 15 32768 sitm
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301468.TE
1469.PP
1470For example, on many IBM PC consoles, the underline attribute collides with the
1471foreground color blue and is not available in color mode.
1472These should have
1473an \fBncv\fR capability of 2.
1474.PP
1475SVr4 curses does nothing with \fBncv\fR, ncurses recognizes it and optimizes
1476the output in favor of colors.
1477.PP
1478.SS Miscellaneous
1479If the terminal requires other than a null (zero) character as a pad, then this
1480can be given as pad.
1481Only the first character of the pad string is used.
1482If the terminal does not have a pad character, specify npc.
1483Note that ncurses implements the termcap-compatible \fBPC\fR variable;
1484though the application may set this value to something other than
1485a null, ncurses will test \fBnpc\fR first and use napms if the terminal
1486has no pad character.
1487.PP
1488If the terminal can move up or down half a line,
1489this can be indicated with
1490.B hu
1491(half-line up)
1492and
1493.B hd
1494(half-line down).
1495This is primarily useful for superscripts and subscripts on hard-copy terminals.
1496If a hard-copy terminal can eject to the next page (form feed), give this as
1497.B ff
1498(usually control L).
1499.PP
1500If there is a command to repeat a given character a given number of
1501times (to save time transmitting a large number of identical characters)
1502this can be indicated with the parameterized string
1503.BR rep .
1504The first parameter is the character to be repeated and the second
1505is the number of times to repeat it.
Steve Kondikae271bc2015-11-15 02:50:53 +01001506Thus, tparm(repeat_char, 'x', 10) is the same as \*(``xxxxxxxxxx\*(''.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301507.PP
1508If the terminal has a settable command character, such as the \s-1TEKTRONIX\s+1 4025,
1509this can be indicated with
1510.BR cmdch .
1511A prototype command character is chosen which is used in all capabilities.
1512This character is given in the
1513.B cmdch
1514capability to identify it.
1515The following convention is supported on some UNIX systems:
1516The environment is to be searched for a
1517.B CC
1518variable, and if found, all
1519occurrences of the prototype character are replaced with the character
1520in the environment variable.
1521.PP
1522Terminal descriptions that do not represent a specific kind of known
1523terminal, such as
1524.IR switch ,
1525.IR dialup ,
1526.IR patch ,
1527and
1528.IR network ,
1529should include the
1530.B gn
1531(generic) capability so that programs can complain that they do not know
1532how to talk to the terminal.
1533(This capability does not apply to
1534.I virtual
1535terminal descriptions for which the escape sequences are known.)
1536.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001537If the terminal has a \*(``meta key\*('' which acts as a shift key,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301538setting the 8th bit of any character transmitted, this fact can
1539be indicated with
1540.BR km .
1541Otherwise, software will assume that the 8th bit is parity and it
1542will usually be cleared.
Steve Kondikae271bc2015-11-15 02:50:53 +01001543If strings exist to turn this \*(``meta mode\*('' on and off, they
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301544can be given as
1545.B smm
1546and
1547.BR rmm .
1548.PP
1549If the terminal has more lines of memory than will fit on the screen
1550at once, the number of lines of memory can be indicated with
1551.BR lm .
1552A value of
1553.BR lm #0
1554indicates that the number of lines is not fixed,
1555but that there is still more memory than fits on the screen.
1556.PP
1557If the terminal is one of those supported by the \s-1UNIX\s+1 virtual
1558terminal protocol, the terminal number can be given as
1559.BR vt .
1560.PP
1561Media copy
1562strings which control an auxiliary printer connected to the terminal
1563can be given as
1564.BR mc0 :
1565print the contents of the screen,
1566.BR mc4 :
1567turn off the printer, and
1568.BR mc5 :
1569turn on the printer.
1570When the printer is on, all text sent to the terminal will be sent
1571to the printer.
1572It is undefined whether the text is also displayed on the terminal screen
1573when the printer is on.
1574A variation
1575.B mc5p
1576takes one parameter, and leaves the printer on for as many characters
1577as the value of the parameter, then turns the printer off.
1578The parameter should not exceed 255.
1579All text, including
1580.BR mc4 ,
1581is transparently passed to the printer while an
1582.B mc5p
1583is in effect.
1584.PP
1585.SS Glitches and Braindamage
1586.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001587Hazeltine terminals, which do not allow \*(``~\*('' characters to be displayed should
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301588indicate \fBhz\fR.
1589.PP
1590Terminals which ignore a line-feed immediately after an \fBam\fR wrap,
1591such as the Concept and vt100,
1592should indicate \fBxenl\fR.
1593.PP
1594If
1595.B el
1596is required to get rid of standout
1597(instead of merely writing normal text on top of it),
1598\fBxhp\fP should be given.
1599.PP
1600Teleray terminals, where tabs turn all characters moved over to blanks,
1601should indicate \fBxt\fR (destructive tabs).
Steve Kondikae271bc2015-11-15 02:50:53 +01001602Note: the variable indicating this is now \*(``dest_tabs_magic_smso\*(''; in
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301603older versions, it was teleray_glitch.
1604This glitch is also taken to mean that it is not possible to position
Steve Kondikae271bc2015-11-15 02:50:53 +01001605the cursor on top of a \*(``magic cookie\*('',
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301606that to erase standout mode it is instead necessary to use
1607delete and insert line.
1608The ncurses implementation ignores this glitch.
1609.PP
1610The Beehive Superbee, which is unable to correctly transmit the escape
1611or control C characters, has
1612.BR xsb ,
1613indicating that the f1 key is used for escape and f2 for control C.
1614(Only certain Superbees have this problem, depending on the ROM.)
1615Note that in older terminfo versions, this capability was called
Steve Kondikae271bc2015-11-15 02:50:53 +01001616\*(``beehive_glitch\*(''; it is now \*(``no_esc_ctl_c\*(''.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301617.PP
1618Other specific terminal problems may be corrected by adding more
1619capabilities of the form \fBx\fR\fIx\fR.
1620.PP
1621.SS Similar Terminals
1622.PP
1623If there are two very similar terminals, one (the variant) can be defined as
1624being just like the other (the base) with certain exceptions.
1625In the
1626definition of the variant, the string capability \fBuse\fR can be given with
1627the name of the base terminal.
1628The capabilities given before
1629.B use
1630override those in the base type named by
1631.BR use .
1632If there are multiple \fBuse\fR capabilities, they are merged in reverse order.
1633That is, the rightmost \fBuse\fR reference is processed first, then the one to
1634its left, and so forth.
1635Capabilities given explicitly in the entry override
1636those brought in by \fBuse\fR references.
1637.PP
1638A capability can be canceled by placing \fBxx@\fR to the left of the
1639use reference that imports it, where \fIxx\fP is the capability.
1640For example, the entry
Steve Kondikae271bc2015-11-15 02:50:53 +01001641.RS
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301642.PP
Steve Kondikae271bc2015-11-15 02:50:53 +010016432621\-nl, smkx@, rmkx@, use=2621,
1644.RE
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301645.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001646defines a 2621\-nl that does not have the \fBsmkx\fR or \fBrmkx\fR capabilities,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301647and hence does not turn on the function key labels when in visual mode.
1648This is useful for different modes for a terminal, or for different
1649user preferences.
1650.PP
1651.SS Pitfalls of Long Entries
1652.PP
1653Long terminfo entries are unlikely to be a problem; to date, no entry has even
1654approached terminfo's 4096-byte string-table maximum.
1655Unfortunately, the termcap
1656translations are much more strictly limited (to 1023 bytes), thus termcap translations
1657of long terminfo entries can cause problems.
1658.PP
1659The man pages for 4.3BSD and older versions of \fBtgetent()\fP instruct the user to
1660allocate a 1024-byte buffer for the termcap entry.
1661The entry gets null-terminated by
1662the termcap library, so that makes the maximum safe length for a termcap entry
Steve Kondikae271bc2015-11-15 02:50:53 +010016631k\-1 (1023) bytes.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301664Depending on what the application and the termcap library
1665being used does, and where in the termcap file the terminal type that \fBtgetent()\fP
1666is searching for is, several bad things can happen.
1667.PP
1668Some termcap libraries print a warning message or exit if they find an
1669entry that's longer than 1023 bytes; others do not; others truncate the
1670entries to 1023 bytes.
1671Some application programs allocate more than
1672the recommended 1K for the termcap entry; others do not.
1673.PP
1674Each termcap entry has two important sizes associated with it: before
1675"tc" expansion, and after "tc" expansion.
1676"tc" is the capability that
1677tacks on another termcap entry to the end of the current one, to add
1678on its capabilities.
1679If a termcap entry does not use the "tc"
1680capability, then of course the two lengths are the same.
1681.PP
1682The "before tc expansion" length is the most important one, because it
1683affects more than just users of that particular terminal.
1684This is the
1685length of the entry as it exists in /etc/termcap, minus the
1686backslash-newline pairs, which \fBtgetent()\fP strips out while reading it.
1687Some termcap libraries strip off the final newline, too (GNU termcap does not).
1688Now suppose:
Steve Kondikae271bc2015-11-15 02:50:53 +01001689.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301690a termcap entry before expansion is more than 1023 bytes long,
Steve Kondikae271bc2015-11-15 02:50:53 +01001691.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301692and the application has only allocated a 1k buffer,
Steve Kondikae271bc2015-11-15 02:50:53 +01001693.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301694and the termcap library (like the one in BSD/OS 1.1 and GNU) reads
1695the whole entry into the buffer, no matter what its length, to see
1696if it is the entry it wants,
Steve Kondikae271bc2015-11-15 02:50:53 +01001697.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301698and \fBtgetent()\fP is searching for a terminal type that either is the
1699long entry, appears in the termcap file after the long entry, or
1700does not appear in the file at all (so that \fBtgetent()\fP has to search
1701the whole termcap file).
1702.PP
1703Then \fBtgetent()\fP will overwrite memory, perhaps its stack, and probably core dump
1704the program.
1705Programs like telnet are particularly vulnerable; modern telnets
1706pass along values like the terminal type automatically.
1707The results are almost
1708as undesirable with a termcap library, like SunOS 4.1.3 and Ultrix 4.4, that
1709prints warning messages when it reads an overly long termcap entry.
1710If a
1711termcap library truncates long entries, like OSF/1 3.0, it is immune to dying
1712here but will return incorrect data for the terminal.
1713.PP
1714The "after tc expansion" length will have a similar effect to the
1715above, but only for people who actually set TERM to that terminal
1716type, since \fBtgetent()\fP only does "tc" expansion once it is found the
1717terminal type it was looking for, not while searching.
1718.PP
1719In summary, a termcap entry that is longer than 1023 bytes can cause,
1720on various combinations of termcap libraries and applications, a core
1721dump, warnings, or incorrect operation.
1722If it is too long even before
1723"tc" expansion, it will have this effect even for users of some other
1724terminal types and users whose TERM variable does not have a termcap
1725entry.
1726.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001727When in \-C (translate to termcap) mode, the \fBncurses\fR implementation of
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301728\fB@TIC@\fR(1M) issues warning messages when the pre-tc length of a termcap
1729translation is too long.
Steve Kondikae271bc2015-11-15 02:50:53 +01001730The \-c (check) option also checks resolved (after tc
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301731expansion) lengths.
1732.SS Binary Compatibility
1733It is not wise to count on portability of binary terminfo entries between
1734commercial UNIX versions.
1735The problem is that there are at least two versions
Steve Kondikae271bc2015-11-15 02:50:53 +01001736of terminfo (under HP\-UX and AIX) which diverged from System V terminfo after
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301737SVr1, and have added extension capabilities to the string table that (in the
1738binary format) collide with System V and XSI Curses extensions.
1739.SH EXTENSIONS
Steve Kondikae271bc2015-11-15 02:50:53 +01001740.PP
1741Searching for terminal descriptions in
1742\fB$HOME/.terminfo\fR and TERMINFO_DIRS
1743is not supported by older implementations.
1744.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301745Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, do not
1746interpret the %A and %O operators in parameter strings.
1747.PP
1748SVr4/XPG4 do not specify whether \fBmsgr\fR licenses movement while in
1749an alternate-character-set mode (such modes may, among other things, map
1750CR and NL to characters that do not trigger local motions).
1751The \fBncurses\fR implementation ignores \fBmsgr\fR in \fBALTCHARSET\fR
1752mode.
1753This raises the possibility that an XPG4
1754implementation making the opposite interpretation may need terminfo
1755entries made for \fBncurses\fR to have \fBmsgr\fR turned off.
1756.PP
1757The \fBncurses\fR library handles insert-character and insert-character modes
1758in a slightly non-standard way to get better update efficiency.
1759See
1760the \fBInsert/Delete Character\fR subsection above.
1761.PP
1762The parameter substitutions for \fBset_clock\fR and \fBdisplay_clock\fR are
1763not documented in SVr4 or the XSI Curses standard.
1764They are deduced from the
1765documentation for the AT&T 505 terminal.
1766.PP
1767Be careful assigning the \fBkmous\fR capability.
1768The \fBncurses\fR wants to
1769interpret it as \fBKEY_MOUSE\fR, for use by terminals and emulators like xterm
1770that can return mouse-tracking information in the keyboard-input stream.
1771.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001772X/Open Curses does not mention italics.
1773Portable applications must assume that numeric capabilities are
1774signed 16-bit values.
1775This includes the \fIno_color_video\fP (ncv) capability.
1776The 32768 mask value used for italics with ncv can be confused with
1777an absent or cancelled ncv.
1778If italics should work with colors,
1779then the ncv value must be specified, even if it is zero.
1780.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301781Different commercial ports of terminfo and curses support different subsets of
1782the XSI Curses standard and (in some cases) different extension sets.
1783Here
1784is a summary, accurate as of October 1995:
1785.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001786\fBSVR4, Solaris, ncurses\fR \-\-
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301787These support all SVr4 capabilities.
1788.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001789\fBSGI\fR \-\-
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301790Supports the SVr4 set, adds one undocumented extended string
1791capability (\fBset_pglen\fR).
1792.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001793\fBSVr1, Ultrix\fR \-\-
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301794These support a restricted subset of terminfo capabilities.
Steve Kondikae271bc2015-11-15 02:50:53 +01001795The booleans end with \fBxon_xoff\fR;
1796the numerics with \fBwidth_status_line\fR;
1797and the strings with \fBprtr_non\fR.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301798.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001799\fBHP/UX\fR \-\-
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301800Supports the SVr1 subset, plus the SVr[234] numerics \fBnum_labels\fR,
1801\fBlabel_height\fR, \fBlabel_width\fR, plus function keys 11 through 63, plus
1802\fBplab_norm\fR, \fBlabel_on\fR, and \fBlabel_off\fR, plus some incompatible
1803extensions in the string table.
1804.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001805\fBAIX\fR \-\-
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301806Supports the SVr1 subset, plus function keys 11 through 63, plus a number
1807of incompatible string table extensions.
1808.PP
Steve Kondikae271bc2015-11-15 02:50:53 +01001809\fBOSF\fR \-\-
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301810Supports both the SVr4 set and the AIX extensions.
1811.SH FILES
1812.TP 25
1813\*d/?/*
1814files containing terminal descriptions
1815.SH SEE ALSO
1816\fB@TIC@\fR(1M),
1817\fB@INFOCMP@\fR(1M),
1818\fBcurses\fR(3X),
1819\fBprintf\fR(3),
1820\fBterm\fR(\*n).
Steve Kondikae271bc2015-11-15 02:50:53 +01001821\fBterm_variables\fR(3X).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301822.SH AUTHORS
1823Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey.
1824Based on pcurses by Pavel Curtis.