1 .\" $Id: terminfo.tail,v 1.85 2017/04/22 18:59:02 tom Exp $
2 .\" Beginning of terminfo.tail file
3 .\" This file is part of ncurses.
4 .\" See "terminfo.head" for copyright.
6 .SS User-Defined Capabilities
8 The preceding section listed the \fIpredefined\fP capabilities.
9 They deal with some special features for terminals no longer
10 (or possibly never) produced.
11 Occasionally there are special features of newer terminals which
12 are awkward or impossible to represent by reusing the predefined
15 \fBncurses\fP addresses this limitation by allowing user-defined capabilities.
16 The \fB@TIC@\fP and \fB@INFOCMP@\fP programs provide
17 the \fB\-x\fP option for this purpose.
18 When \fB\-x\fP is set,
19 \fB@TIC@\fP treats unknown capabilities as user-defined.
20 That is, if \fB@TIC@\fP encounters a capability name
21 which it does not recognize,
22 it infers its type (boolean, number or string) from the syntax
23 and makes an extended table entry for that capability.
24 The \fBuse_extended_names\fP(3X) function makes this information
25 conditionally available to applications.
26 The ncurses library provides the data leaving most of the behavior
29 User-defined capability strings whose name begins
30 with \*(``k\*('' are treated as function keys.
32 The types (boolean, number, string) determined by \fB@TIC@\fP
33 can be inferred by successful calls on \fBtigetflag\fP, etc.
35 If the capability name happens to be two characters,
36 the capability is also available through the termcap interface.
38 While termcap is said to be extensible because it does not use a predefined set
40 in practice it has been limited to the capabilities defined by
41 terminfo implementations.
43 user-defined capabilities intended for use by termcap applications should
44 be limited to booleans and numbers to avoid running past the 1023 byte
45 limit assumed by termcap implementations and their applications.
46 In particular, providing extended sets of function keys (past the 60
47 numbered keys and the handful of special named keys) is best done using
48 the longer names available using terminfo.
52 The following entry, describing an ANSI-standard terminal, is representative
53 of what a \fBterminfo\fR entry for a modern terminal typically looks like.
57 \s-2ansi|ansi/pc-term compatible with color,
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%;
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,
90 Entries may continue onto multiple lines by placing white space at
91 the beginning of each line except the first.
92 Comments may be included on lines beginning with \*(``#\*(''.
97 Boolean capabilities which indicate that the terminal has
98 some particular feature,
100 numeric capabilities giving the size of the terminal
101 or the size of particular delays, and
104 capabilities, which give a sequence which can be used to perform particular
107 .SS Types of Capabilities
109 All capabilities have names.
110 For instance, the fact that
111 ANSI-standard terminals have
112 .I "automatic margins"
113 (i.e., an automatic return and line-feed
114 when the end of a line is reached) is indicated by the capability \fBam\fR.
115 Hence the description of ansi includes \fBam\fR.
116 Numeric capabilities are followed by the character \*(``#\*('' and then a positive value.
117 Thus \fBcols\fR, which indicates the number of columns the terminal has,
118 gives the value \*(``80\*('' for ansi.
119 Values for numeric capabilities may be specified in decimal, octal or hexadecimal,
120 using the C programming language conventions (e.g., 255, 0377 and 0xff or 0xFF).
122 Finally, string valued capabilities, such as \fBel\fR (clear to end of line
123 sequence) are given by the two-character code, an \*(``=\*('', and then a string
124 ending at the next following \*(``,\*(''.
126 A number of escape sequences are provided in the string valued capabilities
127 for easy encoding of characters there:
129 Both \fB\eE\fR and \fB\ee\fR
130 map to an \s-1ESCAPE\s0 character,
132 \fB^x\fR maps to a control-x for any appropriate \fIx\fP, and
137 \fB\en\fP, \fB\el\fP, \fB\er\fP, \fB\et\fP, \fB\eb\fP, \fB\ef\fP, and \fB\es\fR
143 \fInewline\fP, \fIline-feed\fP, \fIreturn\fP, \fItab\fP, \fIbackspace\fP, \fIform-feed\fP, and \fIspace\fP,
148 X/Open Curses does not say what \*(``appropriate \fIx\fP\*('' might be.
149 In practice, that is a printable ASCII graphic character.
150 The special case \*(``^?\*('' is interpreted as DEL (127).
151 In all other cases, the character value is AND'd with 0x1f,
152 mapping to ASCII control codes in the range 0 through 31.
154 Other escapes include
156 \fB\e^\fR for \fB^\fR,
158 \fB\e\e\fR for \fB\e\fR,
162 \fB\e:\fR for \fB:\fR,
164 and \fB\e0\fR for null.
166 \fB\e0\fR will produce \e200, which does not terminate a string but behaves
167 as a null character on most terminals, providing CS7 is specified.
170 The reason for this quirk is to maintain binary compatibility of the
171 compiled terminfo files with other implementations,
172 e.g., the SVr4 systems, which document this.
173 Compiled terminfo files use null-terminated strings, with no lengths.
174 Modifying this would require a new binary format,
175 which would not work with other implementations.
177 Finally, characters may be given as three octal digits after a \fB\e\fR.
179 A delay in milliseconds may appear anywhere in a string capability, enclosed in
180 $<..> brackets, as in \fBel\fP=\eEK$<5>,
181 and padding characters are supplied by \fBtputs\fP(3X)
182 to provide this delay.
184 The delay must be a number with at most one decimal
185 place of precision; it may be followed by suffixes \*(``*\*('' or \*(``/\*('' or both.
188 indicates that the padding required is proportional to the number of lines
189 affected by the operation, and the amount given is the per-affected-unit
191 (In the case of insert character, the factor is still the
192 number of \fIlines\fP affected.)
194 Normally, padding is advisory if the device has the \fBxon\fR
195 capability; it is used for cost computation but does not trigger delays.
198 suffix indicates that the padding is mandatory and forces a delay of the given
199 number of milliseconds even on devices for which \fBxon\fR is present to
200 indicate flow control.
202 Sometimes individual capabilities must be commented out.
203 To do this, put a period before the capability name.
204 For example, see the second
206 in the example above.
210 .SS Fetching Compiled Descriptions
212 The \fBncurses\fP library searches for terminal descriptions in several places.
213 It uses only the first description found.
214 The library has a compiled-in list of places to search
215 which can be overridden by environment variables.
216 Before starting to search,
217 \fBncurses\fP eliminates duplicates in its search list.
219 If the environment variable TERMINFO is set, it is interpreted as the pathname
220 of a directory containing the compiled description you are working on.
221 Only that directory is searched.
223 If TERMINFO is not set,
224 \fBncurses\fR will instead look in the directory \fB$HOME/.terminfo\fR
225 for a compiled description.
227 Next, if the environment variable TERMINFO_DIRS is set,
228 \fBncurses\fR will interpret the contents of that variable
229 as a list of colon-separated directories (or database files) to be searched.
231 An empty directory name (i.e., if the variable begins or ends
232 with a colon, or contains adjacent colons)
233 is interpreted as the system location \fI\*d\fR.
235 Finally, \fBncurses\fP searches these compiled-in locations:
238 a list of directories (@TERMINFO_DIRS@), and
240 the system terminfo directory, \fI\*d\fR (the compiled-in default).
242 .SS Preparing Descriptions
244 We now outline how to prepare descriptions of terminals.
245 The most effective way to prepare a terminal description is by imitating
246 the description of a similar terminal in
248 and to build up a description gradually, using partial descriptions
251 or some other screen-oriented program to check that they are correct.
252 Be aware that a very unusual terminal may expose deficiencies in
256 or bugs in the screen-handling code of the test program.
258 To get the padding for insert line right (if the terminal manufacturer
259 did not document it) a severe test is to edit a large file at 9600 baud,
260 delete 16 or so lines from the middle of the screen, then hit the \*(``u\*(''
261 key several times quickly.
262 If the terminal messes up, more padding is usually needed.
263 A similar test can be used for insert character.
265 .SS Basic Capabilities
267 The number of columns on each line for the terminal is given by the
268 \fBcols\fR numeric capability.
269 If the terminal is a \s-1CRT\s0, then the
270 number of lines on the screen is given by the \fBlines\fR capability.
271 If the terminal wraps around to the beginning of the next line when
272 it reaches the right margin, then it should have the \fBam\fR capability.
273 If the terminal can clear its screen, leaving the cursor in the home
274 position, then this is given by the \fBclear\fR string capability.
275 If the terminal overstrikes
276 (rather than clearing a position when a character is struck over)
277 then it should have the \fBos\fR capability.
278 If the terminal is a printing terminal, with no soft copy unit,
284 applies to storage scope terminals, such as \s-1TEKTRONIX\s+1 4010
285 series, as well as hard copy and APL terminals.)
286 If there is a code to move the cursor to the left edge of the current
289 (Normally this will be carriage return, control M.)
290 If there is a code to produce an audible signal (bell, beep, etc)
294 If there is a code to move the cursor one position to the left
295 (such as backspace) that capability should be given as
297 Similarly, codes to move to the right, up, and down should be
303 These local cursor motions should not alter the text they pass over,
304 for example, you would not normally use \*(``\fBcuf1\fP=\ \*('' because the
305 space would erase the character moved over.
307 A very important point here is that the local cursor motions encoded
310 are undefined at the left and top edges of a \s-1CRT\s0 terminal.
311 Programs should never attempt to backspace around the left edge,
315 and never attempt to go up locally off the top.
316 In order to scroll text up, a program will go to the bottom left corner
317 of the screen and send the
321 To scroll text down, a program goes to the top left corner
322 of the screen and sends the
324 (reverse index) string.
329 are undefined when not on their respective corners of the screen.
331 Parameterized versions of the scrolling sequences are
335 which have the same semantics as
339 except that they take one parameter, and scroll that many lines.
340 They are also undefined except at the appropriate edge of the screen.
342 The \fBam\fR capability tells whether the cursor sticks at the right
343 edge of the screen when text is output, but this does not necessarily
346 from the last column.
347 The only local motion which is defined from the left edge is if
351 from the left edge will move to the right edge of the previous row.
354 is not given, the effect is undefined.
355 This is useful for drawing a box around the edge of the screen, for example.
356 If the terminal has switch selectable automatic margins,
359 file usually assumes that this is on; i.e., \fBam\fR.
360 If the terminal has a command which moves to the first column of the next
361 line, that command can be given as
364 It does not matter if the command clears the remainder of the current line,
365 so if the terminal has no
369 it may still be possible to craft a working
371 out of one or both of them.
373 These capabilities suffice to describe hard-copy and \*(lqglass-tty\*(rq terminals.
374 Thus the model 33 teletype is described as
380 \s-133\||\|tty33\||\|tty\||\|model 33 teletype,
381 bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1
386 while the Lear Siegler \s-1ADM-3\s0 is described as
392 \s-1adm3\||\|3\||\|lsi adm3,
393 am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
394 ind=^J, lines#24,\s+1
399 .SS Parameterized Strings
401 Cursor addressing and other strings requiring parameters
402 in the terminal are described by a
403 parameterized string capability,
404 with \fIprintf\fP-like escapes such as \fI%x\fR in it.
405 For example, to address the cursor, the
407 capability is given, using two parameters:
408 the row and column to address to.
409 (Rows and columns are numbered from zero and refer to the
410 physical screen visible to the user, not to any unseen memory.)
411 If the terminal has memory relative cursor addressing,
412 that can be indicated by
415 The parameter mechanism uses a stack and special \fB%\fP codes
417 Typically a sequence will push one of the
418 parameters onto the stack and then print it in some format.
419 Print (e.g., "%d") is a special case.
420 Other operations, including "%t" pop their operand from the stack.
421 It is noted that more complex operations are often necessary,
422 e.g., in the \fBsgr\fP string.
424 The \fB%\fR encodings have the following meanings:
430 \fB%\fP\fI[[\fP:\fI]flags][width[.precision]][\fP\fBdoxXs\fP\fI]\fP
431 as in \fBprintf\fP, flags are \fI[\-+#]\fP and \fIspace\fP.
432 Use a \*(``:\*('' to allow the next character to be a \*(``\-\*('' flag,
433 avoiding interpreting "%\-" as an operator.
436 print \fIpop()\fP like %c in \fBprintf\fP
439 print \fIpop()\fP like %s in \fBprintf\fP
442 push \fIi\fP'th parameter
445 set dynamic variable \fI[a\-z]\fP to \fIpop()\fP
447 \fB%g\fP\fI[a\-z]/\fP
448 get dynamic variable \fI[a\-z]\fP and push it
451 set static variable \fI[a\-z]\fP to \fIpop()\fP
454 get static variable \fI[a\-z]\fP and push it
456 The terms "static" and "dynamic" are misleading.
457 Historically, these are simply two different sets of variables,
458 whose values are not reset between calls to \fBtparm\fP(3X).
459 However, that fact is not documented in other implementations.
460 Relying on it will adversely impact portability to other implementations.
462 \fB%'\fP\fIc\fP\fB'\fP
463 char constant \fIc\fP
465 \fB%{\fP\fInn\fP\fB}\fP
466 integer constant \fInn\fP
471 \fB%+\fP, \fB%\-\fP, \fB%*\fP, \fB%/\fP, \fB%m\fP
472 arithmetic (%m is \fImod\fP): \fIpush(pop() op pop())\fP
474 \fB%&\fP, \fB%|\fP, \fB%^\fP
475 bit operations (AND, OR and exclusive-OR): \fIpush(pop() op pop())\fP
477 \fB%=\fP, \fB%>\fP, \fB%<\fP
478 logical operations: \fIpush(pop() op pop())\fP
481 logical AND and OR operations (for conditionals)
484 unary operations (logical and bit complement): \fIpush(op pop())\fP
487 add 1 to first two parameters (for ANSI terminals)
489 \fB%?\fP \fIexpr\fP \fB%t\fP \fIthenpart\fP \fB%e\fP \fIelsepart\fP \fB%;\fP
490 This forms an if-then-else.
491 The \fB%e\fP \fIelsepart\fP is optional.
492 Usually the \fB%?\fP \fIexpr\fP part pushes a value onto the stack,
493 and \fB%t\fP pops it from the stack, testing if it is nonzero (true).
494 If it is zero (false), control passes to the \fB%e\fP (else) part.
496 It is possible to form else-if's a la Algol 68:
498 \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
501 where c\di\u are conditions, b\di\u are bodies.
503 Use the \fB\-f\fP option of \fB@TIC@\fP or \fB@INFOCMP@\fP to see
504 the structure of if-then-else's.
505 Some strings, e.g., \fBsgr\fP can be very complicated when written
507 The \fB\-f\fP option splits the string into lines with the parts indented.
509 Binary operations are in postfix form with the operands in the usual order.
510 That is, to get x\-5 one would use "%gx%{5}%-".
511 \fB%P\fP and \fB%g\fP variables are
512 persistent across escape-string evaluations.
514 Consider the HP2645, which, to get to row 3 and column 12, needs
515 to be sent \eE&a12c03Y padded for 6 milliseconds.
517 of the rows and columns is inverted here, and that the row and column
518 are printed as two digits.
519 Thus its \fBcup\fR capability is \*(lqcup=6\eE&%p2%2dc%p1%2dY\*(rq.
521 The Microterm \s-1ACT-IV\s0 needs the current row and column sent
522 preceded by a \fB^T\fR, with the row and column simply encoded in binary,
523 \*(lqcup=^T%p1%c%p2%c\*(rq.
524 Terminals which use \*(lq%c\*(rq need to be able to
525 backspace the cursor (\fBcub1\fR),
526 and to move the cursor up one line on the screen (\fBcuu1\fR).
527 This is necessary because it is not always safe to transmit \fB\en\fR
528 \fB^D\fR and \fB\er\fR, as the system may change or discard them.
529 (The library routines dealing with terminfo set tty modes so that
530 tabs are never expanded, so \et is safe to send.
531 This turns out to be essential for the Ann Arbor 4080.)
533 A final example is the \s-1LSI ADM\s0-3a, which uses row and column
534 offset by a blank character, thus \*(lqcup=\eE=%p1%' '%+%c%p2%' '%+%c\*(rq.
535 After sending \*(``\eE=\*('', this pushes the first parameter, pushes the
536 ASCII value for a space (32), adds them (pushing the sum on the stack
537 in place of the two previous values) and outputs that value as a character.
538 Then the same is done for the second parameter.
539 More complex arithmetic is possible using the stack.
543 If the terminal has a fast way to home the cursor
544 (to very upper left corner of screen) then this can be given as
545 \fBhome\fR; similarly a fast way of getting to the lower left-hand corner
546 can be given as \fBll\fR; this may involve going up with \fBcuu1\fR
547 from the home position,
548 but a program should never do this itself (unless \fBll\fR does) because it
549 can make no assumption about the effect of moving up from the home position.
550 Note that the home position is the same as addressing to (0,0):
551 to the top left corner of the screen, not of memory.
552 (Thus, the \eEH sequence on HP terminals cannot be used for
555 If the terminal has row or column absolute cursor addressing,
556 these can be given as single parameter capabilities
558 (horizontal position absolute)
561 (vertical position absolute).
562 Sometimes these are shorter than the more general two parameter
563 sequence (as with the hp2645) and can be used in preference to
565 If there are parameterized local motions (e.g., move
567 spaces to the right) these can be given as
573 with a single parameter indicating how many spaces to move.
574 These are primarily useful if the terminal does not have
576 such as the \s-1TEKTRONIX\s+1 4025.
578 If the terminal needs to be in a special mode when running
579 a program that uses these capabilities,
580 the codes to enter and exit this mode can be given as \fBsmcup\fR and \fBrmcup\fR.
581 This arises, for example, from terminals like the Concept with more than
583 If the terminal has only memory relative cursor addressing and not screen
584 relative cursor addressing, a one screen-sized window must be fixed into
585 the terminal for cursor addressing to work properly.
586 This is also used for the \s-1TEKTRONIX\s+1 4025,
589 sets the command character to be the one used by terminfo.
590 If the \fBsmcup\fP sequence will not restore the screen after an
591 \fBrmcup\fP sequence is output (to the state prior to outputting
592 \fBrmcup\fP), specify \fBnrrmc\fP.
596 If the terminal can clear from the current position to the end of the
597 line, leaving the cursor where it is, this should be given as \fBel\fR.
598 If the terminal can clear from the beginning of the line to the current
599 position inclusive, leaving
600 the cursor where it is, this should be given as \fBel1\fP.
601 If the terminal can clear from the current position to the end of the
602 display, then this should be given as \fBed\fR.
603 \fBEd\fR is only defined from the first column of a line.
604 (Thus, it can be simulated by a request to delete a large number of lines,
609 .SS Insert/delete line and vertical motions
611 If the terminal can open a new blank line before the line where the cursor
612 is, this should be given as \fBil1\fR; this is done only from the first
614 The cursor must then appear on the newly blank line.
615 If the terminal can delete the line which the cursor is on, then this
616 should be given as \fBdl1\fR; this is done only from the first position on
617 the line to be deleted.
622 which take a single parameter and insert or delete that many lines can
628 If the terminal has a settable scrolling region (like the vt100)
629 the command to set this can be described with the
631 capability, which takes two parameters:
632 the top and bottom lines of the scrolling region.
633 The cursor position is, alas, undefined after using this command.
635 It is possible to get the effect of insert or delete line using
637 on a properly chosen region; the
641 (save and restore cursor) commands may be useful for ensuring that
642 your synthesized insert/delete string does not move the cursor.
643 (Note that the \fBncurses\fR(3X) library does this synthesis
644 automatically, so you need not compose insert/delete strings for
645 an entry with \fBcsr\fR).
647 Yet another way to construct insert and delete might be to use a combination of
648 index with the memory-lock feature found on some terminals (like the HP\-700/90
649 series, which however also has insert/delete).
651 Inserting lines at the top or bottom of the screen can also be
656 on many terminals without a true insert/delete line,
657 and is often faster even on terminals with those features.
659 The boolean \fBnon_dest_scroll_region\fR should be set if each scrolling
660 window is effectively a view port on a screen-sized canvas.
662 this capability, create a scrolling region in the middle of the screen,
663 write something to the bottom line, move the cursor to the top of the region,
664 and do \fBri\fR followed by \fBdl1\fR or \fBind\fR.
666 off the bottom of the region by the \fBri\fR re-appears, then scrolling
668 System V and XSI Curses expect that \fBind\fR, \fBri\fR,
669 \fBindn\fR, and \fBrin\fR will simulate destructive scrolling; their
670 documentation cautions you not to define \fBcsr\fR unless this is true.
671 This \fBcurses\fR implementation is more liberal and will do explicit erases
672 after scrolling if \fBndsrc\fR is defined.
674 If the terminal has the ability to define a window as part of
675 memory, which all commands affect,
676 it should be given as the parameterized string
678 The four parameters are the starting and ending lines in memory
679 and the starting and ending columns in memory, in that order.
681 If the terminal can retain display memory above, then the
682 \fBda\fR capability should be given; if display memory can be retained
683 below, then \fBdb\fR should be given.
685 that deleting a line or scrolling may bring non-blank lines up from below
686 or that scrolling back with \fBri\fR may bring down non-blank lines.
688 .SS Insert/Delete Character
690 There are two basic kinds of intelligent terminals with respect to
691 insert/delete character which can be described using
693 The most common insert/delete character operations affect only the characters
694 on the current line and shift characters off the end of the line rigidly.
695 Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make
696 a distinction between typed and untyped blanks on the screen, shifting
697 upon an insert or delete only to an untyped blank on the screen which is
698 either eliminated, or expanded to two untyped blanks.
700 You can determine the
701 kind of terminal you have by clearing the screen and then typing
702 text separated by cursor motions.
703 Type \*(lqabc\ \ \ \ def\*(rq using local
704 cursor motions (not spaces) between the \*(lqabc\*(rq and the \*(lqdef\*(rq.
705 Then position the cursor before the \*(lqabc\*(rq and put the terminal in insert
707 If typing characters causes the rest of the line to shift
708 rigidly and characters to fall off the end, then your terminal does
709 not distinguish between blanks and untyped positions.
711 shifts over to the \*(lqdef\*(rq which then move together around the end of the
712 current line and onto the next as you insert, you have the second type of
713 terminal, and should give the capability \fBin\fR, which stands for
714 \*(lqinsert null\*(rq.
716 While these are two logically separate attributes (one line versus multi-line
717 insert mode, and special treatment of untyped spaces) we have seen no
718 terminals whose insert mode cannot be described with the single attribute.
720 Terminfo can describe both terminals which have an insert mode, and terminals
721 which send a simple sequence to open a blank position on the current line.
722 Give as \fBsmir\fR the sequence to get into insert mode.
723 Give as \fBrmir\fR the sequence to leave insert mode.
724 Now give as \fBich1\fR any sequence needed to be sent just before sending
725 the character to be inserted.
726 Most terminals with a true insert mode
727 will not give \fBich1\fR; terminals which send a sequence to open a screen
728 position should give it here.
730 If your terminal has both, insert mode is usually preferable to \fBich1\fR.
731 Technically, you should not give both unless the terminal actually requires
732 both to be used in combination.
733 Accordingly, some non-curses applications get
734 confused if both are present; the symptom is doubled characters in an update
736 This requirement is now rare; most \fBich\fR sequences do not
737 require previous smir, and most smir insert modes do not require \fBich1\fR
738 before each character.
739 Therefore, the new \fBcurses\fR actually assumes this
740 is the case and uses either \fBrmir\fR/\fBsmir\fR or \fBich\fR/\fBich1\fR as
741 appropriate (but not both).
742 If you have to write an entry to be used under
743 new curses for a terminal old enough to need both, include the
744 \fBrmir\fR/\fBsmir\fR sequences in \fBich1\fR.
746 If post insert padding is needed, give this as a number of milliseconds
747 in \fBip\fR (a string option).
748 Any other sequence which may need to be
749 sent after an insert of a single character may also be given in \fBip\fR.
750 If your terminal needs both to be placed into an \*(``insert mode\*('' and
751 a special code to precede each inserted character, then both
755 can be given, and both will be used.
758 capability, with one parameter,
760 will repeat the effects of
765 If padding is necessary between characters typed while not
766 in insert mode, give this as a number of milliseconds padding in \fBrmp\fP.
768 It is occasionally necessary to move around while in insert mode
769 to delete characters on the same line (e.g., if there is a tab after
770 the insertion position).
771 If your terminal allows motion while in
772 insert mode you can give the capability \fBmir\fR to speed up inserting
774 Omitting \fBmir\fR will affect only speed.
776 (notably Datamedia's) must not have \fBmir\fR because of the way their
779 Finally, you can specify
781 to delete a single character,
787 and delete mode by giving \fBsmdc\fR and \fBrmdc\fR
788 to enter and exit delete mode (any mode the terminal needs to be placed
795 characters (equivalent to outputting
797 blanks without moving the cursor)
802 .SS "Highlighting, Underlining, and Visible Bells"
804 If your terminal has one or more kinds of display attributes,
805 these can be represented in a number of different ways.
806 You should choose one display form as
808 representing a good, high contrast, easy-on-the-eyes,
809 format for highlighting error messages and other attention getters.
810 (If you have a choice, reverse video plus half-bright is good,
811 or reverse video alone.)
812 The sequences to enter and exit standout mode
813 are given as \fBsmso\fR and \fBrmso\fR, respectively.
814 If the code to change into or out of standout
815 mode leaves one or even two blank spaces on the screen,
816 as the TVI 912 and Teleray 1061 do,
817 then \fBxmc\fR should be given to tell how many spaces are left.
819 Codes to begin underlining and end underlining can be given as \fBsmul\fR
820 and \fBrmul\fR respectively.
821 If the terminal has a code to underline the current character and move
822 the cursor one space to the right,
823 such as the Microterm Mime,
824 this can be given as \fBuc\fR.
826 Other capabilities to enter various highlighting modes include
830 (bold or extra bright)
834 (blanking or invisible text)
844 (enter alternate character set mode)
847 (exit alternate character set mode).
848 Turning on any of these modes singly may or may not turn off other modes.
850 If there is a sequence to set arbitrary combinations of modes,
851 this should be given as
855 Each parameter is either 0 or nonzero, as the corresponding attribute is on or off.
856 The 9 parameters are, in order:
857 standout, underline, reverse, blink, dim, bold, blank, protect, alternate
859 Not all modes need be supported by
861 only those for which corresponding separate attribute commands exist.
863 For example, the DEC vt220 supports most of the modes:
870 \fBtparm parameter attribute escape sequence\fP
873 p1 standout \\E[0;1;7m
874 p2 underline \\E[0;4m
881 p9 altcharset ^O (off) ^N (on)
884 We begin each escape sequence by turning off any existing modes, since
885 there is no quick way to determine whether they are active.
886 Standout is set up to be the combination of reverse and bold.
887 The vt220 terminal has a protect mode,
888 though it is not commonly used in sgr
889 because it protects characters on the screen from the host's erasures.
890 The altcharset mode also is different in that it is either ^O or ^N,
891 depending on whether it is off or on.
892 If all modes are turned on, the resulting sequence is \\E[0;1;4;5;7;8m^N.
894 Some sequences are common to different modes.
895 For example, ;7 is output when either p1 or p3 is true, that is, if
896 either standout or reverse modes are turned on.
898 Writing out the above sequences, along with their dependencies yields
906 \fBsequence when to output terminfo translation\fP
910 ;1 if p1 or p6 %?%p1%p6%|%t;1%;
911 ;4 if p2 %?%p2%|%t;4%;
912 ;5 if p4 %?%p4%|%t;5%;
913 ;7 if p1 or p3 %?%p1%p3%|%t;7%;
914 ;8 if p7 %?%p7%|%t;8%;
916 ^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%;
920 Putting this all together into the sgr sequence gives:
924 sgr=\\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%;
925 %?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\\016%e\\017%;,
929 Remember that if you specify sgr, you must also specify sgr0.
930 Also, some implementations rely on sgr being given if sgr0 is,
931 Not all terminfo entries necessarily have an sgr string, however.
932 Many terminfo entries are derived from termcap entries
933 which have no sgr string.
934 The only drawback to adding an sgr string is that termcap also
935 assumes that sgr0 does not exit alternate character set mode.
937 Terminals with the \*(``magic cookie\*('' glitch
939 deposit special \*(``cookies\*('' when they receive mode-setting sequences,
940 which affect the display algorithm rather than having extra bits for
942 Some terminals, such as the HP 2621, automatically leave standout
943 mode when they move to a new line or the cursor is addressed.
944 Programs using standout mode should exit standout mode before
945 moving the cursor or sending a newline,
948 capability, asserting that it is safe to move in standout mode, is present.
951 a way of flashing the screen to indicate an error quietly (a bell replacement)
952 then this can be given as \fBflash\fR; it must not move the cursor.
954 If the cursor needs to be made more visible than normal when it is
955 not on the bottom line (to make, for example, a non-blinking underline into an
956 easier to find block or blinking underline)
957 give this sequence as
959 If there is a way to make the cursor completely invisible, give that as
963 should be given which undoes the effects of both of these modes.
965 If your terminal correctly generates underlined characters
966 (with no special codes needed)
967 even though it does not overstrike,
968 then you should give the capability \fBul\fR.
969 If a character overstriking another leaves both characters on the screen,
970 specify the capability \fBos\fP.
971 If overstrikes are erasable with a blank,
972 then this should be indicated by giving \fBeo\fR.
974 .SS Keypad and Function Keys
976 If the terminal has a keypad that transmits codes when the keys are pressed,
977 this information can be given.
978 Note that it is not possible to handle
979 terminals where the keypad only works in local (this applies, for example,
980 to the unshifted HP 2621 keys).
981 If the keypad can be set to transmit or not transmit,
982 give these codes as \fBsmkx\fR and \fBrmkx\fR.
983 Otherwise the keypad is assumed to always transmit.
985 The codes sent by the left arrow, right arrow, up arrow, down arrow,
986 and home keys can be given as
987 \fBkcub1, kcuf1, kcuu1, kcud1, \fRand\fB khome\fR respectively.
988 If there are function keys such as f0, f1, ..., f10, the codes they send
989 can be given as \fBkf0, kf1, ..., kf10\fR.
990 If these keys have labels other than the default f0 through f10, the labels
991 can be given as \fBlf0, lf1, ..., lf10\fR.
993 The codes transmitted by certain other special keys can be given:
1005 (clear the tab stop in this column),
1008 (clear screen or erase key),
1020 (clear to end of line),
1023 (clear to end of screen),
1026 (insert character or enter insert mode),
1038 (scroll forward/down),
1041 (scroll backward/up),
1044 (set a tab stop in this column).
1046 In addition, if the keypad has a 3 by 3 array of keys including the four
1047 arrow keys, the other five keys can be given as
1054 These keys are useful when the effects of a 3 by 3 directional pad are needed.
1056 Strings to program function keys can be given as
1061 A string to program screen labels should be specified as \fBpln\fP.
1062 Each of these strings takes two parameters: the function key number to
1063 program (from 0 to 10) and the string to program it with.
1064 Function key numbers out of this range may program undefined keys in
1065 a terminal dependent manner.
1066 The difference between the capabilities is that
1068 causes pressing the given key to be the same as the user typing the
1071 causes the string to be executed by the terminal in local; and
1073 causes the string to be transmitted to the computer.
1075 The capabilities \fBnlab\fP, \fBlw\fP and \fBlh\fP
1076 define the number of programmable
1077 screen labels and their width and height.
1078 If there are commands to turn the labels on and off,
1079 give them in \fBsmln\fP and \fBrmln\fP.
1080 \fBsmln\fP is normally output after one or more pln
1081 sequences to make sure that the change becomes visible.
1083 .SS Tabs and Initialization
1085 If the terminal has hardware tabs, the command to advance to the next
1086 tab stop can be given as
1088 (usually control I).
1089 A \*(``back-tab\*('' command which moves leftward to the preceding tab stop can
1092 By convention, if the teletype modes indicate that tabs are being
1093 expanded by the computer rather than being sent to the terminal,
1094 programs should not use
1098 even if they are present, since the user may not have the tab stops
1100 If the terminal has hardware tabs which are initially set every
1102 spaces when the terminal is powered up,
1103 the numeric parameter
1105 is given, showing the number of spaces the tabs are set to.
1106 This is normally used by the \fB@TSET@\fP
1107 command to determine whether to set the mode for hardware tab expansion,
1108 and whether to set the tab stops.
1109 If the terminal has tab stops that can be saved in non-volatile memory,
1110 the terminfo description can assume that they are properly set.
1118 initialization strings for the terminal,
1120 the path name of a program to be run to initialize the terminal,
1121 and \fBif\fR, the name of a file containing long initialization strings.
1122 These strings are expected to set the terminal into modes consistent
1123 with the rest of the terminfo description.
1124 They are normally sent to the terminal, by the
1126 option of the \fB@TPUT@\fP program, each time the user logs in.
1127 They will be printed in the following order:
1137 set the margins using
1156 Most initialization is done with
1158 Special terminal modes can be set up without duplicating strings
1159 by putting the common sequences in
1161 and special cases in
1166 A set of sequences that does a harder reset from a totally unknown state
1180 These strings are output by the \fB@RESET@\fP program,
1181 which is used when the terminal gets into a wedged state.
1182 Commands are normally placed in
1188 only if they produce annoying effects on the screen and are not
1189 necessary when logging in.
1190 For example, the command to set the vt100 into 80-column mode would
1193 but it causes an annoying glitch of the screen and is not normally
1194 needed since the terminal is usually already in 80 column mode.
1196 The \fB@RESET@\fP program writes strings including
1198 etc., in the same order as the
1211 reset capability strings are missing, the \fB@RESET@\fP
1212 program falls back upon the corresponding initialization capability string.
1214 If there are commands to set and clear tab stops, they can be given as
1216 (clear all tab stops)
1219 (set a tab stop in the current column of every row).
1220 If a more complex sequence is needed to set the tabs than can be
1221 described by this, the sequence can be placed in
1225 .SS Delays and Padding
1227 Many older and slower terminals do not support either XON/XOFF or DTR
1228 handshaking, including hard copy terminals and some very archaic CRTs
1229 (including, for example, DEC VT100s).
1230 These may require padding characters
1231 after certain cursor motions and screen changes.
1233 If the terminal uses xon/xoff handshaking for flow control (that is,
1234 it automatically emits ^S back to the host when its input buffers are
1237 This capability suppresses the emission of padding.
1239 for memory-mapped console devices effectively that do not have a speed limit.
1240 Padding information should still be included so that routines can
1241 make better decisions about relative costs, but actual pad characters will
1244 If \fBpb\fR (padding baud rate) is given, padding is suppressed at baud rates
1245 below the value of \fBpb\fR.
1246 If the entry has no padding baud rate, then
1247 whether padding is emitted or not is completely controlled by \fBxon\fR.
1249 If the terminal requires other than a null (zero) character as a pad,
1250 then this can be given as \fBpad\fR.
1251 Only the first character of the
1256 Some terminals have an extra \*(``status line\*('' which is not normally used by
1257 software (and thus not counted in the terminal's \fBlines\fR capability).
1259 The simplest case is a status line which is cursor-addressable but not
1260 part of the main scrolling region on the screen; the Heathkit H19 has
1261 a status line of this kind, as would a 24-line VT100 with a 23-line
1262 scrolling region set up on initialization.
1263 This situation is indicated
1264 by the \fBhs\fR capability.
1266 Some terminals with status lines need special sequences to access the
1268 These may be expressed as a string with single parameter
1269 \fBtsl\fR which takes the cursor to a given zero-origin column on the
1271 The capability \fBfsl\fR must return to the main-screen
1272 cursor positions before the last \fBtsl\fR.
1273 You may need to embed the
1274 string values of \fBsc\fR (save cursor) and \fBrc\fR (restore cursor)
1275 in \fBtsl\fR and \fBfsl\fR to accomplish this.
1277 The status line is normally assumed to be the same width as the width
1279 If this is untrue, you can specify it with the numeric
1280 capability \fBwsl\fR.
1282 A command to erase or blank the status line may be specified as \fBdsl\fR.
1284 The boolean capability \fBeslok\fR specifies that escape sequences, tabs,
1285 etc., work ordinarily in the status line.
1287 The \fBncurses\fR implementation does not yet use any of these capabilities.
1288 They are documented here in case they ever become important.
1292 Many terminals have alternate character sets useful for forms-drawing.
1293 Terminfo and \fBcurses\fR built-in support for the drawing characters
1294 supported by the VT100, with some characters from the AT&T 4410v1 added.
1295 This alternate character set may be specified by the \fBacsc\fR capability.
1302 lw25 lw10 lw6 lw6 lw6.
1304 \fBGlyph ACS Ascii VT100 VT100\fR
1305 \fBName Name Default Char Code\fR
1306 arrow pointing right ACS_RARROW > + 0x2b
1307 arrow pointing left ACS_LARROW < , 0x2c
1308 arrow pointing up ACS_UARROW ^ \- 0x2d
1309 arrow pointing down ACS_DARROW v . 0x2e
1310 solid square block ACS_BLOCK # 0 0x30
1311 diamond ACS_DIAMOND + ` 0x60
1312 checker board (stipple) ACS_CKBOARD : a 0x61
1313 degree symbol ACS_DEGREE \e f 0x66
1314 plus/minus ACS_PLMINUS # g 0x67
1315 board of squares ACS_BOARD # h 0x68
1316 lantern symbol ACS_LANTERN # i 0x69
1317 lower right corner ACS_LRCORNER + j 0x6a
1318 upper right corner ACS_URCORNER + k 0x6b
1319 upper left corner ACS_ULCORNER + l 0x6c
1320 lower left corner ACS_LLCORNER + m 0x6d
1321 large plus or crossover ACS_PLUS + n 0x6e
1322 scan line 1 ACS_S1 ~ o 0x6f
1323 scan line 3 ACS_S3 \- p 0x70
1324 horizontal line ACS_HLINE \- q 0x71
1325 scan line 7 ACS_S7 \- r 0x72
1326 scan line 9 ACS_S9 \&_ s 0x73
1327 tee pointing right ACS_LTEE + t 0x74
1328 tee pointing left ACS_RTEE + u 0x75
1329 tee pointing up ACS_BTEE + v 0x76
1330 tee pointing down ACS_TTEE + w 0x77
1331 vertical line ACS_VLINE | x 0x78
1332 less-than-or-equal-to ACS_LEQUAL < y 0x79
1333 greater-than-or-equal-to ACS_GEQUAL > z 0x7a
1334 greek pi ACS_PI * { 0x7b
1335 not-equal ACS_NEQUAL ! | 0x7c
1336 UK pound sign ACS_STERLING f } 0x7d
1337 bullet ACS_BULLET o ~ 0x7e
1340 A few notes apply to the table itself:
1342 X/Open Curses incorrectly states that the mapping for \fIlantern\fP is
1343 uppercase \*(``I\*('' although Unix implementations use the
1344 lowercase \*(``i\*('' mapping.
1346 The DEC VT100 implemented graphics using the alternate character set
1347 feature, temporarily switching \fImodes\fP and sending characters
1348 in the range 0x60 (96) to 0x7e (126).
1350 The AT&T terminal added graphics characters outside that range.
1352 The best way to define a new device's graphics set is to add a column
1353 to a copy of this table for your terminal, giving the character which
1354 (when emitted between \fBsmacs\fR/\fBrmacs\fR switches) will be rendered
1355 as the corresponding graphic.
1356 Then read off the VT100/your terminal
1357 character pairs right to left in sequence; these become the ACSC string.
1361 The curses library functions \fBinit_pair\fP and \fBinit_color\fP
1362 manipulate the \fIcolor pairs\fP and \fIcolor values\fP discussed in this
1364 (see \fBcurs_color\fP(3X) for details on these and related functions).
1366 Most color terminals are either \*(``Tektronix-like\*('' or \*(``HP-like\*('':
1369 terminals have a predefined set of \fIN\fP colors
1370 (where \fIN\fP is usually 8),
1372 character-cell foreground and background characters independently, mixing them
1373 into \fIN\fP\ *\ \fIN\fP color-pairs.
1375 On HP-like terminals, the user must set each color
1376 pair up separately (foreground and background are not independently settable).
1377 Up to \fIM\fP color-pairs may be set up from 2*\fIM\fP different colors.
1378 ANSI-compatible terminals are Tektronix-like.
1380 Some basic color capabilities are independent of the color method.
1382 capabilities \fBcolors\fR and \fBpairs\fR specify the maximum numbers of colors
1383 and color-pairs that can be displayed simultaneously.
1384 The \fBop\fR (original
1385 pair) string resets foreground and background colors to their default values
1387 The \fBoc\fR string resets all colors or color-pairs to
1388 their default values for the terminal.
1389 Some terminals (including many PC
1390 terminal emulators) erase screen areas with the current background color rather
1391 than the power-up default background; these should have the boolean capability
1394 While the curses library works with \fIcolor pairs\fP
1395 (reflecting the inability of some devices to set foreground
1396 and background colors independently),
1397 there are separate capabilities for setting these features:
1399 To change the current foreground or background color on a Tektronix-type
1400 terminal, use \fBsetaf\fR (set ANSI foreground) and \fBsetab\fR (set ANSI
1401 background) or \fBsetf\fR (set foreground) and \fBsetb\fR (set background).
1402 These take one parameter, the color number.
1403 The SVr4 documentation describes
1404 only \fBsetaf\fR/\fBsetab\fR; the XPG4 draft says that "If the terminal
1405 supports ANSI escape sequences to set background and foreground, they should
1406 be coded as \fBsetaf\fR and \fBsetab\fR, respectively.
1409 supports other escape sequences to set background and foreground, they should
1410 be coded as \fBsetf\fR and \fBsetb\fR, respectively.
1411 The \fBvidputs\fR and the \fBrefresh\fP(3X) functions
1412 use the \fBsetaf\fR and \fBsetab\fR capabilities if they are defined.
1414 The \fBsetaf\fR/\fBsetab\fR and \fBsetf\fR/\fBsetb\fR capabilities take a
1415 single numeric argument each.
1416 Argument values 0-7 of \fBsetaf\fR/\fBsetab\fR are portably defined as
1417 follows (the middle column is the symbolic #define available in the header for
1418 the \fBcurses\fR or \fBncurses\fR libraries).
1419 The terminal hardware is free to
1420 map these as it likes, but the RGB values indicate normal locations in color
1427 \fBColor #define Value RGB\fR
1428 black \fBCOLOR_BLACK\fR 0 0, 0, 0
1429 red \fBCOLOR_RED\ \fR 1 max,0,0
1430 green \fBCOLOR_GREEN\fR 2 0,max,0
1431 yellow \fBCOLOR_YELLOW\fR 3 max,max,0
1432 blue \fBCOLOR_BLUE\fR 4 0,0,max
1433 magenta \fBCOLOR_MAGENTA\fR 5 max,0,max
1434 cyan \fBCOLOR_CYAN\fR 6 0,max,max
1435 white \fBCOLOR_WHITE\fR 7 max,max,max
1438 The argument values of \fBsetf\fR/\fBsetb\fR historically correspond to
1439 a different mapping, i.e.,
1444 \fBColor #define Value RGB\fR
1445 black \fBCOLOR_BLACK\fR 0 0, 0, 0
1446 blue \fBCOLOR_BLUE\fR 1 0,0,max
1447 green \fBCOLOR_GREEN\fR 2 0,max,0
1448 cyan \fBCOLOR_CYAN\fR 3 0,max,max
1449 red \fBCOLOR_RED\ \fR 4 max,0,0
1450 magenta \fBCOLOR_MAGENTA\fR 5 max,0,max
1451 yellow \fBCOLOR_YELLOW\fR 6 max,max,0
1452 white \fBCOLOR_WHITE\fR 7 max,max,max
1455 It is important to not confuse the two sets of color capabilities;
1456 otherwise red/blue will be interchanged on the display.
1458 On an HP-like terminal, use \fBscp\fR with a color-pair number parameter to set
1459 which color pair is current.
1461 Some terminals allow the \fIcolor values\fP to be modified:
1463 On a Tektronix-like terminal, the capability \fBccc\fR may be present to
1464 indicate that colors can be modified.
1465 If so, the \fBinitc\fR capability will
1466 take a color number (0 to \fBcolors\fR \- 1)and three more parameters which
1468 These three parameters default to being interpreted as RGB
1469 (Red, Green, Blue) values.
1470 If the boolean capability \fBhls\fR is present,
1471 they are instead as HLS (Hue, Lightness, Saturation) indices.
1475 On an HP-like terminal, \fBinitp\fR may give a capability for changing a
1477 It will take seven parameters; a color-pair number (0 to
1478 \fBmax_pairs\fR \- 1), and two triples describing first background and then
1480 These parameters must be (Red, Green, Blue) or
1481 (Hue, Lightness, Saturation) depending on \fBhls\fR.
1483 On some color terminals, colors collide with highlights.
1485 these collisions with the \fBncv\fR capability.
1486 This is a bit-mask of
1487 attributes not to be used when colors are enabled.
1488 The correspondence with the
1489 attributes understood by \fBcurses\fR is as follows:
1495 \fBAttribute Bit Decimal Set by\fR
1504 A_ALTCHARSET 8 256 sgr
1505 A_HORIZONTAL 9 512 sgr1
1508 A_RIGHT 12 4096 sgr1
1510 A_VERTICAL 14 16384 sgr1
1511 A_ITALIC 15 32768 sitm
1514 For example, on many IBM PC consoles, the underline attribute collides with the
1515 foreground color blue and is not available in color mode.
1517 an \fBncv\fR capability of 2.
1519 SVr4 curses does nothing with \fBncv\fR, ncurses recognizes it and optimizes
1520 the output in favor of colors.
1523 If the terminal requires other than a null (zero) character as a pad, then this
1524 can be given as pad.
1525 Only the first character of the pad string is used.
1526 If the terminal does not have a pad character, specify npc.
1527 Note that ncurses implements the termcap-compatible \fBPC\fR variable;
1528 though the application may set this value to something other than
1529 a null, ncurses will test \fBnpc\fR first and use napms if the terminal
1530 has no pad character.
1532 If the terminal can move up or down half a line,
1533 this can be indicated with
1539 This is primarily useful for superscripts and subscripts on hard-copy terminals.
1540 If a hard-copy terminal can eject to the next page (form feed), give this as
1542 (usually control L).
1544 If there is a command to repeat a given character a given number of
1545 times (to save time transmitting a large number of identical characters)
1546 this can be indicated with the parameterized string
1548 The first parameter is the character to be repeated and the second
1549 is the number of times to repeat it.
1550 Thus, tparm(repeat_char, 'x', 10) is the same as \*(``xxxxxxxxxx\*(''.
1552 If the terminal has a settable command character, such as the \s-1TEKTRONIX\s+1 4025,
1553 this can be indicated with
1555 A prototype command character is chosen which is used in all capabilities.
1556 This character is given in the
1558 capability to identify it.
1559 The following convention is supported on some UNIX systems:
1560 The environment is to be searched for a
1562 variable, and if found, all
1563 occurrences of the prototype character are replaced with the character
1564 in the environment variable.
1566 Terminal descriptions that do not represent a specific kind of known
1575 (generic) capability so that programs can complain that they do not know
1576 how to talk to the terminal.
1577 (This capability does not apply to
1579 terminal descriptions for which the escape sequences are known.)
1581 If the terminal has a \*(``meta key\*('' which acts as a shift key,
1582 setting the 8th bit of any character transmitted, this fact can
1585 Otherwise, software will assume that the 8th bit is parity and it
1586 will usually be cleared.
1587 If strings exist to turn this \*(``meta mode\*('' on and off, they
1593 If the terminal has more lines of memory than will fit on the screen
1594 at once, the number of lines of memory can be indicated with
1598 indicates that the number of lines is not fixed,
1599 but that there is still more memory than fits on the screen.
1601 If the terminal is one of those supported by the \s-1UNIX\s+1 virtual
1602 terminal protocol, the terminal number can be given as
1606 strings which control an auxiliary printer connected to the terminal
1609 print the contents of the screen,
1611 turn off the printer, and
1613 turn on the printer.
1614 When the printer is on, all text sent to the terminal will be sent
1616 It is undefined whether the text is also displayed on the terminal screen
1617 when the printer is on.
1620 takes one parameter, and leaves the printer on for as many characters
1621 as the value of the parameter, then turns the printer off.
1622 The parameter should not exceed 255.
1625 is transparently passed to the printer while an
1629 .SS Glitches and Braindamage
1631 Hazeltine terminals, which do not allow \*(``~\*('' characters to be displayed should
1634 Terminals which ignore a line-feed immediately after an \fBam\fR wrap,
1635 such as the Concept and vt100,
1636 should indicate \fBxenl\fR.
1640 is required to get rid of standout
1641 (instead of merely writing normal text on top of it),
1642 \fBxhp\fP should be given.
1644 Teleray terminals, where tabs turn all characters moved over to blanks,
1645 should indicate \fBxt\fR (destructive tabs).
1646 Note: the variable indicating this is now \*(``dest_tabs_magic_smso\*(''; in
1647 older versions, it was teleray_glitch.
1648 This glitch is also taken to mean that it is not possible to position
1649 the cursor on top of a \*(``magic cookie\*('',
1650 that to erase standout mode it is instead necessary to use
1651 delete and insert line.
1652 The ncurses implementation ignores this glitch.
1654 The Beehive Superbee, which is unable to correctly transmit the escape
1655 or control C characters, has
1657 indicating that the f1 key is used for escape and f2 for control C.
1658 (Only certain Superbees have this problem, depending on the ROM.)
1659 Note that in older terminfo versions, this capability was called
1660 \*(``beehive_glitch\*(''; it is now \*(``no_esc_ctl_c\*(''.
1662 Other specific terminal problems may be corrected by adding more
1663 capabilities of the form \fBx\fR\fIx\fR.
1665 .SS Pitfalls of Long Entries
1667 Long terminfo entries are unlikely to be a problem; to date, no entry has even
1668 approached terminfo's 4096-byte string-table maximum.
1669 Unfortunately, the termcap
1670 translations are much more strictly limited (to 1023 bytes), thus termcap translations
1671 of long terminfo entries can cause problems.
1673 The man pages for 4.3BSD and older versions of \fBtgetent\fP instruct the user to
1674 allocate a 1024-byte buffer for the termcap entry.
1675 The entry gets null-terminated by
1676 the termcap library, so that makes the maximum safe length for a termcap entry
1678 Depending on what the application and the termcap library
1679 being used does, and where in the termcap file the terminal type that \fBtgetent\fP
1680 is searching for is, several bad things can happen.
1682 Some termcap libraries print a warning message or exit if they find an
1683 entry that's longer than 1023 bytes; others do not; others truncate the
1684 entries to 1023 bytes.
1685 Some application programs allocate more than
1686 the recommended 1K for the termcap entry; others do not.
1688 Each termcap entry has two important sizes associated with it: before
1689 "tc" expansion, and after "tc" expansion.
1690 "tc" is the capability that
1691 tacks on another termcap entry to the end of the current one, to add
1692 on its capabilities.
1693 If a termcap entry does not use the "tc"
1694 capability, then of course the two lengths are the same.
1696 The "before tc expansion" length is the most important one, because it
1697 affects more than just users of that particular terminal.
1699 length of the entry as it exists in /etc/termcap, minus the
1700 backslash-newline pairs, which \fBtgetent\fP strips out while reading it.
1701 Some termcap libraries strip off the final newline, too (GNU termcap does not).
1704 a termcap entry before expansion is more than 1023 bytes long,
1706 and the application has only allocated a 1k buffer,
1708 and the termcap library (like the one in BSD/OS 1.1 and GNU) reads
1709 the whole entry into the buffer, no matter what its length, to see
1710 if it is the entry it wants,
1712 and \fBtgetent\fP is searching for a terminal type that either is the
1713 long entry, appears in the termcap file after the long entry, or
1714 does not appear in the file at all (so that \fBtgetent\fP has to search
1715 the whole termcap file).
1717 Then \fBtgetent\fP will overwrite memory, perhaps its stack, and probably core dump
1719 Programs like telnet are particularly vulnerable; modern telnets
1720 pass along values like the terminal type automatically.
1721 The results are almost
1722 as undesirable with a termcap library, like SunOS 4.1.3 and Ultrix 4.4, that
1723 prints warning messages when it reads an overly long termcap entry.
1725 termcap library truncates long entries, like OSF/1 3.0, it is immune to dying
1726 here but will return incorrect data for the terminal.
1728 The "after tc expansion" length will have a similar effect to the
1729 above, but only for people who actually set TERM to that terminal
1730 type, since \fBtgetent\fP only does "tc" expansion once it is found the
1731 terminal type it was looking for, not while searching.
1733 In summary, a termcap entry that is longer than 1023 bytes can cause,
1734 on various combinations of termcap libraries and applications, a core
1735 dump, warnings, or incorrect operation.
1736 If it is too long even before
1737 "tc" expansion, it will have this effect even for users of some other
1738 terminal types and users whose TERM variable does not have a termcap
1741 When in \-C (translate to termcap) mode, the \fBncurses\fR implementation of
1742 \fB@TIC@\fR(1M) issues warning messages when the pre-tc length of a termcap
1743 translation is too long.
1744 The \-c (check) option also checks resolved (after tc
1746 .SS Binary Compatibility
1747 It is not wise to count on portability of binary terminfo entries between
1748 commercial UNIX versions.
1749 The problem is that there are at least two versions
1750 of terminfo (under HP\-UX and AIX) which diverged from System V terminfo after
1751 SVr1, and have added extension capabilities to the string table that (in the
1752 binary format) collide with System V and XSI Curses extensions.
1755 Searching for terminal descriptions in
1756 \fB$HOME/.terminfo\fR and TERMINFO_DIRS
1757 is not supported by older implementations.
1759 Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, do not
1760 interpret the %A and %O operators in parameter strings.
1762 SVr4/XPG4 do not specify whether \fBmsgr\fR licenses movement while in
1763 an alternate-character-set mode (such modes may, among other things, map
1764 CR and NL to characters that do not trigger local motions).
1765 The \fBncurses\fR implementation ignores \fBmsgr\fR in \fBALTCHARSET\fR
1767 This raises the possibility that an XPG4
1768 implementation making the opposite interpretation may need terminfo
1769 entries made for \fBncurses\fR to have \fBmsgr\fR turned off.
1771 The \fBncurses\fR library handles insert-character and insert-character modes
1772 in a slightly non-standard way to get better update efficiency.
1774 the \fBInsert/Delete Character\fR subsection above.
1776 The parameter substitutions for \fBset_clock\fR and \fBdisplay_clock\fR are
1777 not documented in SVr4 or the XSI Curses standard.
1778 They are deduced from the
1779 documentation for the AT&T 505 terminal.
1781 Be careful assigning the \fBkmous\fR capability.
1782 The \fBncurses\fR library wants to interpret it as \fBKEY_MOUSE\fR,
1783 for use by terminals and emulators like xterm
1784 that can return mouse-tracking information in the keyboard-input stream.
1786 X/Open Curses does not mention italics.
1787 Portable applications must assume that numeric capabilities are
1788 signed 16-bit values.
1789 This includes the \fIno_color_video\fP (ncv) capability.
1790 The 32768 mask value used for italics with ncv can be confused with
1791 an absent or cancelled ncv.
1792 If italics should work with colors,
1793 then the ncv value must be specified, even if it is zero.
1795 Different commercial ports of terminfo and curses support different subsets of
1796 the XSI Curses standard and (in some cases) different extension sets.
1798 is a summary, accurate as of October 1995:
1800 \fBSVR4, Solaris, ncurses\fR \-\-
1801 These support all SVr4 capabilities.
1804 Supports the SVr4 set, adds one undocumented extended string
1805 capability (\fBset_pglen\fR).
1807 \fBSVr1, Ultrix\fR \-\-
1808 These support a restricted subset of terminfo capabilities.
1809 The booleans end with \fBxon_xoff\fR;
1810 the numerics with \fBwidth_status_line\fR;
1811 and the strings with \fBprtr_non\fR.
1814 Supports the SVr1 subset, plus the SVr[234] numerics \fBnum_labels\fR,
1815 \fBlabel_height\fR, \fBlabel_width\fR, plus function keys 11 through 63, plus
1816 \fBplab_norm\fR, \fBlabel_on\fR, and \fBlabel_off\fR, plus some incompatible
1817 extensions in the string table.
1820 Supports the SVr1 subset, plus function keys 11 through 63, plus a number
1821 of incompatible string table extensions.
1824 Supports both the SVr4 set and the AIX extensions.
1828 files containing terminal descriptions
1831 \fB@INFOCMP@\fR(1M),
1833 \fBcurs_color\fR(3X),
1836 \fBterm_variables\fR(3X).
1838 Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey.
1839 Based on pcurses by Pavel Curtis.