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