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