source: trunk/ncurses/man/terminfo.tail@ 2787

Last change on this file since 2787 was 2621, checked in by bird, 19 years ago

GNU ncurses 5.5

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