1terminfo(5) File Formats terminfo(5)
2
3
4
6 terminfo - terminal capability data base
7
9 /usr/share/terminfo/*/*
10
12 Terminfo is a data base describing terminals, used by screen-oriented
13 programs such as nvi(1), rogue(1) and libraries such as curses(3X).
14 Terminfo describes terminals by giving a set of capabilities which they
15 have, by specifying how to perform screen operations, and by specifying
16 padding requirements and initialization sequences. This describes
17 ncurses version 6.1 (patch 20180224).
18
19 Terminfo Entry Syntax
20 Entries in terminfo consist of a sequence of fields:
21
22 · Each field ends with a comma “,” (embedded commas may be escaped
23 with a backslash or written as “\054”).
24
25 · White space between fields is ignored.
26
27 · The first field in a terminfo entry begins in the first column.
28
29 · Newlines and leading whitespace (spaces or tabs) may be used for
30 formatting entries for readability. These are removed from parsed
31 entries.
32
33 The infocmp -f and -W options rely on this to format if-then-else
34 expressions, or to enforce maximum line-width. The resulting for‐
35 matted terminal description can be read by tic.
36
37 · The first field for each terminal gives the names which are known
38 for the terminal, separated by “|” characters.
39
40 The first name given is the most common abbreviation for the termi‐
41 nal (its primary name), the last name given should be a long name
42 fully identifying the terminal (see longname(3X)), and all others
43 are treated as synonyms (aliases) for the primary terminal name.
44
45 X/Open Curses advises that all names but the last should be in
46 lower case and contain no blanks; the last name may well contain
47 upper case and blanks for readability.
48
49 This implementation is not so strict; it allows mixed case in the
50 primary name and aliases. If the last name has no embedded blanks,
51 it allows that to be both an alias and a verbose name (but will
52 warn about this ambiguity).
53
54 · Lines beginning with a “#” in the first column are treated as com‐
55 ments.
56
57 While comment lines are legal at any point, the output of captoinfo
58 and infotocap (aliases for tic) will move comments so they occur
59 only between entries.
60
61 Terminal names (except for the last, verbose entry) should be chosen
62 using the following conventions. The particular piece of hardware mak‐
63 ing up the terminal should have a root name, thus “hp2621”. This name
64 should not contain hyphens. Modes that the hardware can be in, or user
65 preferences, should be indicated by appending a hyphen and a mode suf‐
66 fix. Thus, a vt100 in 132 column mode would be vt100-w. The following
67 suffixes should be used where possible:
68
69 Suffix Meaning Example
70 -nn Number of lines on the screen aaa-60
71 -np Number of pages of memory c100-4p
72 -am With automargins (usually the default) vt100-am
73 -m Mono mode; suppress color ansi-m
74 -mc Magic cookie; spaces when highlighting wy30-mc
75 -na No arrow keys (leave them in local) c100-na
76 -nam Without automatic margins vt100-nam
77 -nl No status line att4415-nl
78 -ns No status line hp2626-ns
79 -rv Reverse video c100-rv
80 -s Enable status line vt100-s
81 -vb Use visible bell instead of beep wy370-vb
82 -w Wide mode (> 80 columns, usually 132) vt100-w
83
84 For more on terminal naming conventions, see the term(7) manual page.
85
86 Terminfo Capabilities Syntax
87 The terminfo entry consists of several capabilities, i.e., features
88 that the terminal has, or methods for exercising the terminal's fea‐
89 tures.
90
91 After the first field (giving the name(s) of the terminal entry), there
92 should be one or more capability fields. These are boolean, numeric or
93 string names with corresponding values:
94
95 · Boolean capabilities are true when present, false when absent.
96 There is no explicit value for boolean capabilities.
97
98 · Numeric capabilities have a “#” following the name, then an
99 unsigned decimal integer value.
100
101 · String capabilities have a “=” following the name, then an string
102 of characters making up the capability value.
103
104 String capabilities can be split into multiple lines, just as the
105 fields comprising a terminal entry can be split into multiple
106 lines. While blanks between fields are ignored, blanks embedded
107 within a string value are retained, except for leading blanks on a
108 line.
109
110 Any capability can be canceled, i.e., suppressed from the terminal
111 entry, by following its name with “@” rather than a capability value.
112
113 Similar Terminals
114 If there are two very similar terminals, one (the variant) can be
115 defined as being just like the other (the base) with certain excep‐
116 tions. In the definition of the variant, the string capability use can
117 be given with the name of the base terminal:
118
119 · The capabilities given before use override those in the base type
120 named by use.
121
122 · If there are multiple use capabilities, they are merged in reverse
123 order. That is, the rightmost use reference is processed first,
124 then the one to its left, and so forth.
125
126 · Capabilities given explicitly in the entry override those brought
127 in by use references.
128
129 A capability can be canceled by placing xx@ to the left of the use ref‐
130 erence that imports it, where xx is the capability. For example, the
131 entry
132
133 2621-nl, smkx@, rmkx@, use=2621,
134
135 defines a 2621-nl that does not have the smkx or rmkx capabilities, and
136 hence does not turn on the function key labels when in visual mode.
137 This is useful for different modes for a terminal, or for different
138 user preferences.
139
140 An entry included via use can contain canceled capabilities, which have
141 the same effect as if those cancels were inline in the using terminal
142 entry.
143
144 Predefined Capabilities
145 The following is a complete table of the capabilities included in a
146 terminfo description block and available to terminfo-using code. In
147 each line of the table,
148
149 The variable is the name by which the programmer (at the terminfo
150 level) accesses the capability.
151
152 The capname is the short name used in the text of the database, and is
153 used by a person updating the database. Whenever possible, capnames
154 are chosen to be the same as or similar to the ANSI X3.64-1979 standard
155 (now superseded by ECMA-48, which uses identical or very similar
156 names). Semantics are also intended to match those of the specifica‐
157 tion.
158
159 The termcap code is the old termcap capability name (some capabilities
160 are new, and have names which termcap did not originate).
161
162 Capability names have no hard length limit, but an informal limit of 5
163 characters has been adopted to keep them short and to allow the tabs in
164 the source file Caps to line up nicely.
165
166 Finally, the description field attempts to convey the semantics of the
167 capability. You may find some codes in the description field:
168
169 (P) indicates that padding may be specified
170
171 #[1-9] in the description field indicates that the string is passed
172 through tparm with parms as given (#i).
173
174 (P*) indicates that padding may vary in proportion to the number of
175 lines affected
176
177 (#i) indicates the ith parameter.
178
179
180 These are the boolean capabilities:
181
182
183 Variable Cap- TCap Description
184 Booleans name Code
185 auto_left_margin bw bw cub1 wraps from col‐
186 umn 0 to last column
187 auto_right_margin am am terminal has auto‐
188 matic margins
189 back_color_erase bce ut screen erased with
190 background color
191 can_change ccc cc terminal can re-
192 define existing col‐
193 ors
194 ceol_standout_glitch xhp xs standout not erased
195 by overwriting (hp)
196 col_addr_glitch xhpa YA only positive motion
197 for hpa/mhpa caps
198
199 cpi_changes_res cpix YF changing character
200 pitch changes reso‐
201 lution
202 cr_cancels_micro_mode crxm YB using cr turns off
203 micro mode
204 dest_tabs_magic_smso xt xt tabs destructive,
205 magic so char
206 (t1061)
207 eat_newline_glitch xenl xn newline ignored
208 after 80 cols (con‐
209 cept)
210 erase_overstrike eo eo can erase over‐
211 strikes with a blank
212 generic_type gn gn generic line type
213 hard_copy hc hc hardcopy terminal
214 hard_cursor chts HC cursor is hard to
215 see
216 has_meta_key km km Has a meta key
217 (i.e., sets 8th-bit)
218 has_print_wheel daisy YC printer needs opera‐
219 tor to change char‐
220 acter set
221 has_status_line hs hs has extra status
222 line
223 hue_lightness_saturation hls hl terminal uses only
224 HLS color notation
225 (Tektronix)
226 insert_null_glitch in in insert mode distin‐
227 guishes nulls
228 lpi_changes_res lpix YG changing line pitch
229 changes resolution
230 memory_above da da display may be
231 retained above the
232 screen
233 memory_below db db display may be
234 retained below the
235 screen
236 move_insert_mode mir mi safe to move while
237 in insert mode
238 move_standout_mode msgr ms safe to move while
239 in standout mode
240 needs_xon_xoff nxon nx padding will not
241 work, xon/xoff
242 required
243 no_esc_ctlc xsb xb beehive (f1=escape,
244 f2=ctrl C)
245 no_pad_char npc NP pad character does
246 not exist
247 non_dest_scroll_region ndscr ND scrolling region is
248 non-destructive
249 non_rev_rmcup nrrmc NR smcup does not
250 reverse rmcup
251 over_strike os os terminal can over‐
252 strike
253 prtr_silent mc5i 5i printer will not
254 echo on screen
255 row_addr_glitch xvpa YD only positive motion
256 for vpa/mvpa caps
257 semi_auto_right_margin sam YE printing in last
258 column causes cr
259 status_line_esc_ok eslok es escape can be used
260 on the status line
261 tilde_glitch hz hz cannot print ~'s
262 (Hazeltine)
263
264
265 transparent_underline ul ul underline character
266 overstrikes
267 xon_xoff xon xo terminal uses
268 xon/xoff handshaking
269
270 These are the numeric capabilities:
271
272
273 Variable Cap- TCap Description
274 Numeric name Code
275 columns cols co number of columns in
276 a line
277 init_tabs it it tabs initially every
278 # spaces
279 label_height lh lh rows in each label
280 label_width lw lw columns in each
281 label
282 lines lines li number of lines on
283 screen or page
284 lines_of_memory lm lm lines of memory if >
285 line. 0 means varies
286 magic_cookie_glitch xmc sg number of blank
287 characters left by
288 smso or rmso
289 max_attributes ma ma maximum combined
290 attributes terminal
291 can handle
292 max_colors colors Co maximum number of
293 colors on screen
294 max_pairs pairs pa maximum number of
295 color-pairs on the
296 screen
297 maximum_windows wnum MW maximum number of
298 definable windows
299 no_color_video ncv NC video attributes
300 that cannot be used
301 with colors
302 num_labels nlab Nl number of labels on
303 screen
304 padding_baud_rate pb pb lowest baud rate
305 where padding needed
306 virtual_terminal vt vt virtual terminal
307 number (CB/unix)
308 width_status_line wsl ws number of columns in
309 status line
310
311 The following numeric capabilities are present in the SVr4.0 term
312 structure, but are not yet documented in the man page. They came in
313 with SVr4's printer support.
314
315
316 Variable Cap- TCap Description
317 Numeric name Code
318 bit_image_entwining bitwin Yo number of passes for
319 each bit-image row
320 bit_image_type bitype Yp type of bit-image
321 device
322 buffer_capacity bufsz Ya numbers of bytes
323 buffered before
324 printing
325 buttons btns BT number of buttons on
326 mouse
327 dot_horz_spacing spinh Yc spacing of dots hor‐
328 izontally in dots
329 per inch
330
331 dot_vert_spacing spinv Yb spacing of pins ver‐
332 tically in pins per
333 inch
334 max_micro_address maddr Yd maximum value in
335 micro_..._address
336 max_micro_jump mjump Ye maximum value in
337 parm_..._micro
338 micro_col_size mcs Yf character step size
339 when in micro mode
340 micro_line_size mls Yg line step size when
341 in micro mode
342 number_of_pins npins Yh numbers of pins in
343 print-head
344 output_res_char orc Yi horizontal resolu‐
345 tion in units per
346 line
347 output_res_horz_inch orhi Yk horizontal resolu‐
348 tion in units per
349 inch
350 output_res_line orl Yj vertical resolution
351 in units per line
352 output_res_vert_inch orvi Yl vertical resolution
353 in units per inch
354 print_rate cps Ym print rate in char‐
355 acters per second
356 wide_char_size widcs Yn character step size
357 when in double wide
358 mode
359
360 These are the string capabilities:
361
362
363 Variable Cap- TCap Description
364 String name Code
365 acs_chars acsc ac graphics charset
366 pairs, based on
367 vt100
368 back_tab cbt bt back tab (P)
369 bell bel bl audible signal
370 (bell) (P)
371 carriage_return cr cr carriage return (P*)
372 (P*)
373 change_char_pitch cpi ZA Change number of
374 characters per inch
375 to #1
376 change_line_pitch lpi ZB Change number of
377 lines per inch to #1
378 change_res_horz chr ZC Change horizontal
379 resolution to #1
380 change_res_vert cvr ZD Change vertical res‐
381 olution to #1
382 change_scroll_region csr cs change region to
383 line #1 to line #2
384 (P)
385 char_padding rmp rP like ip but when in
386 insert mode
387 clear_all_tabs tbc ct clear all tab stops
388 (P)
389 clear_margins mgc MC clear right and left
390 soft margins
391 clear_screen clear cl clear screen and
392 home cursor (P*)
393 clr_bol el1 cb Clear to beginning
394 of line
395
396
397 clr_eol el ce clear to end of line
398 (P)
399 clr_eos ed cd clear to end of
400 screen (P*)
401 column_address hpa ch horizontal position
402 #1, absolute (P)
403 command_character cmdch CC terminal settable
404 cmd character in
405 prototype !?
406 create_window cwin CW define a window #1
407 from #2,#3 to #4,#5
408 cursor_address cup cm move to row #1 col‐
409 umns #2
410 cursor_down cud1 do down one line
411 cursor_home home ho home cursor (if no
412 cup)
413 cursor_invisible civis vi make cursor invisi‐
414 ble
415 cursor_left cub1 le move left one space
416 cursor_mem_address mrcup CM memory relative cur‐
417 sor addressing, move
418 to row #1 columns #2
419 cursor_normal cnorm ve make cursor appear
420 normal (undo
421 civis/cvvis)
422 cursor_right cuf1 nd non-destructive
423 space (move right
424 one space)
425 cursor_to_ll ll ll last line, first
426 column (if no cup)
427 cursor_up cuu1 up up one line
428 cursor_visible cvvis vs make cursor very
429 visible
430 define_char defc ZE Define a character
431 #1, #2 dots wide,
432 descender #3
433 delete_character dch1 dc delete character
434 (P*)
435 delete_line dl1 dl delete line (P*)
436 dial_phone dial DI dial number #1
437 dis_status_line dsl ds disable status line
438 display_clock dclk DK display clock
439 down_half_line hd hd half a line down
440 ena_acs enacs eA enable alternate
441 char set
442 enter_alt_charset_mode smacs as start alternate
443 character set (P)
444 enter_am_mode smam SA turn on automatic
445 margins
446 enter_blink_mode blink mb turn on blinking
447 enter_bold_mode bold md turn on bold (extra
448 bright) mode
449 enter_ca_mode smcup ti string to start pro‐
450 grams using cup
451 enter_delete_mode smdc dm enter delete mode
452 enter_dim_mode dim mh turn on half-bright
453 mode
454 enter_doublewide_mode swidm ZF Enter double-wide
455 mode
456 enter_draft_quality sdrfq ZG Enter draft-quality
457 mode
458 enter_insert_mode smir im enter insert mode
459 enter_italics_mode sitm ZH Enter italic mode
460 enter_leftward_mode slm ZI Start leftward car‐
461 riage motion
462
463 enter_micro_mode smicm ZJ Start micro-motion
464 mode
465 enter_near_letter_quality snlq ZK Enter NLQ mode
466 enter_normal_quality snrmq ZL Enter normal-quality
467 mode
468 enter_protected_mode prot mp turn on protected
469 mode
470 enter_reverse_mode rev mr turn on reverse
471 video mode
472 enter_secure_mode invis mk turn on blank mode
473 (characters invisi‐
474 ble)
475 enter_shadow_mode sshm ZM Enter shadow-print
476 mode
477 enter_standout_mode smso so begin standout mode
478 enter_subscript_mode ssubm ZN Enter subscript mode
479 enter_superscript_mode ssupm ZO Enter superscript
480 mode
481 enter_underline_mode smul us begin underline mode
482 enter_upward_mode sum ZP Start upward car‐
483 riage motion
484 enter_xon_mode smxon SX turn on xon/xoff
485 handshaking
486 erase_chars ech ec erase #1 characters
487 (P)
488 exit_alt_charset_mode rmacs ae end alternate char‐
489 acter set (P)
490 exit_am_mode rmam RA turn off automatic
491 margins
492 exit_attribute_mode sgr0 me turn off all
493 attributes
494 exit_ca_mode rmcup te strings to end pro‐
495 grams using cup
496 exit_delete_mode rmdc ed end delete mode
497 exit_doublewide_mode rwidm ZQ End double-wide mode
498 exit_insert_mode rmir ei exit insert mode
499 exit_italics_mode ritm ZR End italic mode
500 exit_leftward_mode rlm ZS End left-motion mode
501 exit_micro_mode rmicm ZT End micro-motion
502 mode
503 exit_shadow_mode rshm ZU End shadow-print
504 mode
505 exit_standout_mode rmso se exit standout mode
506 exit_subscript_mode rsubm ZV End subscript mode
507 exit_superscript_mode rsupm ZW End superscript mode
508 exit_underline_mode rmul ue exit underline mode
509 exit_upward_mode rum ZX End reverse charac‐
510 ter motion
511 exit_xon_mode rmxon RX turn off xon/xoff
512 handshaking
513 fixed_pause pause PA pause for 2-3 sec‐
514 onds
515 flash_hook hook fh flash switch hook
516 flash_screen flash vb visible bell (may
517 not move cursor)
518 form_feed ff ff hardcopy terminal
519 page eject (P*)
520 from_status_line fsl fs return from status
521 line
522 goto_window wingo WG go to window #1
523 hangup hup HU hang-up phone
524 init_1string is1 i1 initialization
525 string
526 init_2string is2 is initialization
527 string
528
529 init_3string is3 i3 initialization
530 string
531 init_file if if name of initializa‐
532 tion file
533 init_prog iprog iP path name of program
534 for initialization
535 initialize_color initc Ic initialize color #1
536 to (#2,#3,#4)
537 initialize_pair initp Ip Initialize color
538 pair #1 to
539 fg=(#2,#3,#4),
540 bg=(#5,#6,#7)
541 insert_character ich1 ic insert character (P)
542 insert_line il1 al insert line (P*)
543 insert_padding ip ip insert padding after
544 inserted character
545 key_a1 ka1 K1 upper left of keypad
546 key_a3 ka3 K3 upper right of key‐
547 pad
548 key_b2 kb2 K2 center of keypad
549 key_backspace kbs kb backspace key
550 key_beg kbeg @1 begin key
551 key_btab kcbt kB back-tab key
552 key_c1 kc1 K4 lower left of keypad
553 key_c3 kc3 K5 lower right of key‐
554 pad
555 key_cancel kcan @2 cancel key
556 key_catab ktbc ka clear-all-tabs key
557 key_clear kclr kC clear-screen or
558 erase key
559 key_close kclo @3 close key
560 key_command kcmd @4 command key
561 key_copy kcpy @5 copy key
562 key_create kcrt @6 create key
563 key_ctab kctab kt clear-tab key
564 key_dc kdch1 kD delete-character key
565 key_dl kdl1 kL delete-line key
566 key_down kcud1 kd down-arrow key
567 key_eic krmir kM sent by rmir or smir
568 in insert mode
569 key_end kend @7 end key
570 key_enter kent @8 enter/send key
571 key_eol kel kE clear-to-end-of-line
572 key
573 key_eos ked kS clear-to-end-of-
574 screen key
575 key_exit kext @9 exit key
576 key_f0 kf0 k0 F0 function key
577 key_f1 kf1 k1 F1 function key
578 key_f10 kf10 k; F10 function key
579 key_f11 kf11 F1 F11 function key
580 key_f12 kf12 F2 F12 function key
581 key_f13 kf13 F3 F13 function key
582 key_f14 kf14 F4 F14 function key
583 key_f15 kf15 F5 F15 function key
584 key_f16 kf16 F6 F16 function key
585 key_f17 kf17 F7 F17 function key
586 key_f18 kf18 F8 F18 function key
587 key_f19 kf19 F9 F19 function key
588 key_f2 kf2 k2 F2 function key
589 key_f20 kf20 FA F20 function key
590 key_f21 kf21 FB F21 function key
591 key_f22 kf22 FC F22 function key
592 key_f23 kf23 FD F23 function key
593 key_f24 kf24 FE F24 function key
594
595 key_f25 kf25 FF F25 function key
596 key_f26 kf26 FG F26 function key
597 key_f27 kf27 FH F27 function key
598 key_f28 kf28 FI F28 function key
599 key_f29 kf29 FJ F29 function key
600 key_f3 kf3 k3 F3 function key
601 key_f30 kf30 FK F30 function key
602 key_f31 kf31 FL F31 function key
603 key_f32 kf32 FM F32 function key
604 key_f33 kf33 FN F33 function key
605 key_f34 kf34 FO F34 function key
606 key_f35 kf35 FP F35 function key
607 key_f36 kf36 FQ F36 function key
608 key_f37 kf37 FR F37 function key
609 key_f38 kf38 FS F38 function key
610 key_f39 kf39 FT F39 function key
611 key_f4 kf4 k4 F4 function key
612 key_f40 kf40 FU F40 function key
613 key_f41 kf41 FV F41 function key
614 key_f42 kf42 FW F42 function key
615 key_f43 kf43 FX F43 function key
616 key_f44 kf44 FY F44 function key
617 key_f45 kf45 FZ F45 function key
618 key_f46 kf46 Fa F46 function key
619 key_f47 kf47 Fb F47 function key
620 key_f48 kf48 Fc F48 function key
621 key_f49 kf49 Fd F49 function key
622 key_f5 kf5 k5 F5 function key
623 key_f50 kf50 Fe F50 function key
624 key_f51 kf51 Ff F51 function key
625 key_f52 kf52 Fg F52 function key
626 key_f53 kf53 Fh F53 function key
627 key_f54 kf54 Fi F54 function key
628 key_f55 kf55 Fj F55 function key
629 key_f56 kf56 Fk F56 function key
630 key_f57 kf57 Fl F57 function key
631 key_f58 kf58 Fm F58 function key
632 key_f59 kf59 Fn F59 function key
633 key_f6 kf6 k6 F6 function key
634 key_f60 kf60 Fo F60 function key
635 key_f61 kf61 Fp F61 function key
636 key_f62 kf62 Fq F62 function key
637 key_f63 kf63 Fr F63 function key
638 key_f7 kf7 k7 F7 function key
639 key_f8 kf8 k8 F8 function key
640 key_f9 kf9 k9 F9 function key
641 key_find kfnd @0 find key
642 key_help khlp %1 help key
643 key_home khome kh home key
644 key_ic kich1 kI insert-character key
645 key_il kil1 kA insert-line key
646 key_left kcub1 kl left-arrow key
647 key_ll kll kH lower-left key (home
648 down)
649 key_mark kmrk %2 mark key
650 key_message kmsg %3 message key
651 key_move kmov %4 move key
652 key_next knxt %5 next key
653 key_npage knp kN next-page key
654 key_open kopn %6 open key
655 key_options kopt %7 options key
656 key_ppage kpp kP previous-page key
657 key_previous kprv %8 previous key
658 key_print kprt %9 print key
659 key_redo krdo %0 redo key
660
661 key_reference kref &1 reference key
662 key_refresh krfr &2 refresh key
663 key_replace krpl &3 replace key
664 key_restart krst &4 restart key
665 key_resume kres &5 resume key
666 key_right kcuf1 kr right-arrow key
667 key_save ksav &6 save key
668 key_sbeg kBEG &9 shifted begin key
669 key_scancel kCAN &0 shifted cancel key
670 key_scommand kCMD *1 shifted command key
671 key_scopy kCPY *2 shifted copy key
672 key_screate kCRT *3 shifted create key
673 key_sdc kDC *4 shifted delete-char‐
674 acter key
675 key_sdl kDL *5 shifted delete-line
676 key
677 key_select kslt *6 select key
678 key_send kEND *7 shifted end key
679 key_seol kEOL *8 shifted clear-to-
680 end-of-line key
681 key_sexit kEXT *9 shifted exit key
682 key_sf kind kF scroll-forward key
683 key_sfind kFND *0 shifted find key
684 key_shelp kHLP #1 shifted help key
685 key_shome kHOM #2 shifted home key
686 key_sic kIC #3 shifted insert-char‐
687 acter key
688 key_sleft kLFT #4 shifted left-arrow
689 key
690 key_smessage kMSG %a shifted message key
691 key_smove kMOV %b shifted move key
692 key_snext kNXT %c shifted next key
693 key_soptions kOPT %d shifted options key
694 key_sprevious kPRV %e shifted previous key
695 key_sprint kPRT %f shifted print key
696 key_sr kri kR scroll-backward key
697 key_sredo kRDO %g shifted redo key
698 key_sreplace kRPL %h shifted replace key
699 key_sright kRIT %i shifted right-arrow
700 key
701 key_srsume kRES %j shifted resume key
702 key_ssave kSAV !1 shifted save key
703 key_ssuspend kSPD !2 shifted suspend key
704 key_stab khts kT set-tab key
705 key_sundo kUND !3 shifted undo key
706 key_suspend kspd &7 suspend key
707 key_undo kund &8 undo key
708 key_up kcuu1 ku up-arrow key
709 keypad_local rmkx ke leave 'key‐
710 board_transmit' mode
711 keypad_xmit smkx ks enter 'key‐
712 board_transmit' mode
713 lab_f0 lf0 l0 label on function
714 key f0 if not f0
715 lab_f1 lf1 l1 label on function
716 key f1 if not f1
717 lab_f10 lf10 la label on function
718 key f10 if not f10
719 lab_f2 lf2 l2 label on function
720 key f2 if not f2
721 lab_f3 lf3 l3 label on function
722 key f3 if not f3
723 lab_f4 lf4 l4 label on function
724 key f4 if not f4
725
726
727 lab_f5 lf5 l5 label on function
728 key f5 if not f5
729 lab_f6 lf6 l6 label on function
730 key f6 if not f6
731 lab_f7 lf7 l7 label on function
732 key f7 if not f7
733 lab_f8 lf8 l8 label on function
734 key f8 if not f8
735 lab_f9 lf9 l9 label on function
736 key f9 if not f9
737 label_format fln Lf label format
738 label_off rmln LF turn off soft labels
739 label_on smln LO turn on soft labels
740 meta_off rmm mo turn off meta mode
741 meta_on smm mm turn on meta mode
742 (8th-bit on)
743 micro_column_address mhpa ZY Like column_address
744 in micro mode
745 micro_down mcud1 ZZ Like cursor_down in
746 micro mode
747 micro_left mcub1 Za Like cursor_left in
748 micro mode
749 micro_right mcuf1 Zb Like cursor_right in
750 micro mode
751 micro_row_address mvpa Zc Like row_address #1
752 in micro mode
753 micro_up mcuu1 Zd Like cursor_up in
754 micro mode
755 newline nel nw newline (behave like
756 cr followed by lf)
757 order_of_pins porder Ze Match software bits
758 to print-head pins
759 orig_colors oc oc Set all color pairs
760 to the original ones
761 orig_pair op op Set default pair to
762 its original value
763 pad_char pad pc padding char
764 (instead of null)
765 parm_dch dch DC delete #1 characters
766 (P*)
767 parm_delete_line dl DL delete #1 lines (P*)
768 parm_down_cursor cud DO down #1 lines (P*)
769 parm_down_micro mcud Zf Like parm_down_cur‐
770 sor in micro mode
771 parm_ich ich IC insert #1 characters
772 (P*)
773 parm_index indn SF scroll forward #1
774 lines (P)
775 parm_insert_line il AL insert #1 lines (P*)
776 parm_left_cursor cub LE move #1 characters
777 to the left (P)
778 parm_left_micro mcub Zg Like parm_left_cur‐
779 sor in micro mode
780 parm_right_cursor cuf RI move #1 characters
781 to the right (P*)
782 parm_right_micro mcuf Zh Like parm_right_cur‐
783 sor in micro mode
784 parm_rindex rin SR scroll back #1 lines
785 (P)
786 parm_up_cursor cuu UP up #1 lines (P*)
787 parm_up_micro mcuu Zi Like parm_up_cursor
788 in micro mode
789 pkey_key pfkey pk program function key
790 #1 to type string #2
791
792
793 pkey_local pfloc pl program function key
794 #1 to execute string
795 #2
796 pkey_xmit pfx px program function key
797 #1 to transmit
798 string #2
799 plab_norm pln pn program label #1 to
800 show string #2
801 print_screen mc0 ps print contents of
802 screen
803 prtr_non mc5p pO turn on printer for
804 #1 bytes
805 prtr_off mc4 pf turn off printer
806 prtr_on mc5 po turn on printer
807 pulse pulse PU select pulse dialing
808 quick_dial qdial QD dial number #1 with‐
809 out checking
810 remove_clock rmclk RC remove clock
811 repeat_char rep rp repeat char #1 #2
812 times (P*)
813 req_for_input rfi RF send next input char
814 (for ptys)
815 reset_1string rs1 r1 reset string
816 reset_2string rs2 r2 reset string
817 reset_3string rs3 r3 reset string
818 reset_file rf rf name of reset file
819 restore_cursor rc rc restore cursor to
820 position of last
821 save_cursor
822 row_address vpa cv vertical position #1
823 absolute (P)
824 save_cursor sc sc save current cursor
825 position (P)
826 scroll_forward ind sf scroll text up (P)
827 scroll_reverse ri sr scroll text down (P)
828 select_char_set scs Zj Select character
829 set, #1
830 set_attributes sgr sa define video
831 attributes #1-#9
832 (PG9)
833 set_background setb Sb Set background color
834 #1
835 set_bottom_margin smgb Zk Set bottom margin at
836 current line
837 set_bottom_margin_parm smgbp Zl Set bottom margin at
838 line #1 or (if smgtp
839 is not given) #2
840 lines from bottom
841 set_clock sclk SC set clock, #1 hrs #2
842 mins #3 secs
843 set_color_pair scp sp Set current color
844 pair to #1
845 set_foreground setf Sf Set foreground color
846 #1
847 set_left_margin smgl ML set left soft margin
848 at current col‐
849 umn. See
850 smgl. (ML is not in
851 BSD termcap).
852 set_left_margin_parm smglp Zm Set left (right)
853 margin at column #1
854 set_right_margin smgr MR set right soft mar‐
855 gin at current col‐
856 umn
857
858
859 set_right_margin_parm smgrp Zn Set right margin at
860 column #1
861 set_tab hts st set a tab in every
862 row, current columns
863 set_top_margin smgt Zo Set top margin at
864 current line
865 set_top_margin_parm smgtp Zp Set top (bottom)
866 margin at row #1
867 set_window wind wi current window is
868 lines #1-#2 cols
869 #3-#4
870 start_bit_image sbim Zq Start printing bit
871 image graphics
872 start_char_set_def scsd Zr Start character set
873 definition #1, with
874 #2 characters in the
875 set
876 stop_bit_image rbim Zs Stop printing bit
877 image graphics
878 stop_char_set_def rcsd Zt End definition of
879 character set #1
880 subscript_characters subcs Zu List of subscript‐
881 able characters
882 superscript_characters supcs Zv List of superscript‐
883 able characters
884 tab ht ta tab to next 8-space
885 hardware tab stop
886 these_cause_cr docr Zw Printing any of
887 these characters
888 causes CR
889 to_status_line tsl ts move to status line,
890 column #1
891 tone tone TO select touch tone
892 dialing
893 underline_char uc uc underline char and
894 move past it
895 up_half_line hu hu half a line up
896 user0 u0 u0 User string #0
897 user1 u1 u1 User string #1
898 user2 u2 u2 User string #2
899 user3 u3 u3 User string #3
900 user4 u4 u4 User string #4
901 user5 u5 u5 User string #5
902 user6 u6 u6 User string #6
903 user7 u7 u7 User string #7
904 user8 u8 u8 User string #8
905 user9 u9 u9 User string #9
906 wait_tone wait WA wait for dial-tone
907 xoff_character xoffc XF XOFF character
908 xon_character xonc XN XON character
909 zero_motion zerom Zx No motion for subse‐
910 quent character
911
912 The following string capabilities are present in the SVr4.0 term struc‐
913 ture, but were originally not documented in the man page.
914
915
916 Variable Cap- TCap Description
917 String name Code
918 alt_scancode_esc scesa S8 Alternate escape
919 for scancode emu‐
920 lation
921 bit_image_carriage_return bicr Yv Move to beginning
922 of same row
923
924
925 bit_image_newline binel Zz Move to next row
926 of the bit image
927 bit_image_repeat birep Xy Repeat bit image
928 cell #1 #2 times
929 char_set_names csnm Zy Produce #1'th item
930 from list of char‐
931 acter set names
932 code_set_init csin ci Init sequence for
933 multiple codesets
934 color_names colornm Yw Give name for
935 color #1
936 define_bit_image_region defbi Yx Define rectangular
937 bit image region
938 device_type devt dv Indicate lan‐
939 guage/codeset sup‐
940 port
941 display_pc_char dispc S1 Display PC charac‐
942 ter #1
943 end_bit_image_region endbi Yy End a bit-image
944 region
945 enter_pc_charset_mode smpch S2 Enter PC character
946 display mode
947 enter_scancode_mode smsc S4 Enter PC scancode
948 mode
949 exit_pc_charset_mode rmpch S3 Exit PC character
950 display mode
951 exit_scancode_mode rmsc S5 Exit PC scancode
952 mode
953 get_mouse getm Gm Curses should get
954 button events,
955 parameter #1 not
956 documented.
957 key_mouse kmous Km Mouse event has
958 occurred
959 mouse_info minfo Mi Mouse status
960 information
961 pc_term_options pctrm S6 PC terminal
962 options
963 pkey_plab pfxl xl Program function
964 key #1 to type
965 string #2 and show
966 string #3
967 req_mouse_pos reqmp RQ Request mouse
968 position
969 scancode_escape scesc S7 Escape for scan‐
970 code emulation
971 set0_des_seq s0ds s0 Shift to codeset 0
972 (EUC set 0, ASCII)
973 set1_des_seq s1ds s1 Shift to codeset 1
974 set2_des_seq s2ds s2 Shift to codeset 2
975 set3_des_seq s3ds s3 Shift to codeset 3
976 set_a_background setab AB Set background
977 color to #1, using
978 ANSI escape
979 set_a_foreground setaf AF Set foreground
980 color to #1, using
981 ANSI escape
982 set_color_band setcolor Yz Change to ribbon
983 color #1
984 set_lr_margin smglr ML Set both left and
985 right margins to
986 #1, #2. (ML is
987 not in BSD term‐
988 cap).
989
990
991 set_page_length slines YZ Set page length to
992 #1 lines
993 set_tb_margin smgtb MT Sets both top and
994 bottom margins to
995 #1, #2
996
997 The XSI Curses standard added these hardcopy capabilities. They were
998 used in some post-4.1 versions of System V curses, e.g., Solaris 2.5
999 and IRIX 6.x. Except for YI, the ncurses termcap names for them are
1000 invented. According to the XSI Curses standard, they have no termcap
1001 names. If your compiled terminfo entries use these, they may not be
1002 binary-compatible with System V terminfo entries after SVr4.1; beware!
1003
1004
1005 Variable Cap- TCap Description
1006 String name Code
1007 enter_horizontal_hl_mode ehhlm Xh Enter horizontal
1008 highlight mode
1009 enter_left_hl_mode elhlm Xl Enter left highlight
1010 mode
1011 enter_low_hl_mode elohlm Xo Enter low highlight
1012 mode
1013 enter_right_hl_mode erhlm Xr Enter right high‐
1014 light mode
1015 enter_top_hl_mode ethlm Xt Enter top highlight
1016 mode
1017 enter_vertical_hl_mode evhlm Xv Enter vertical high‐
1018 light mode
1019 set_a_attributes sgr1 sA Define second set of
1020 video attributes
1021 #1-#6
1022 set_pglen_inch slength YI Set page length to
1023 #1 hundredth of an
1024 inch (some implemen‐
1025 tations use sL for
1026 termcap).
1027
1028 User-Defined Capabilities
1029 The preceding section listed the predefined capabilities. They deal
1030 with some special features for terminals no longer (or possibly never)
1031 produced. Occasionally there are special features of newer terminals
1032 which are awkward or impossible to represent by reusing the predefined
1033 capabilities.
1034
1035 ncurses addresses this limitation by allowing user-defined capabili‐
1036 ties. The tic and infocmp programs provide the -x option for this pur‐
1037 pose. When -x is set, tic treats unknown capabilities as user-defined.
1038 That is, if tic encounters a capability name which it does not recog‐
1039 nize, it infers its type (boolean, number or string) from the syntax
1040 and makes an extended table entry for that capability. The
1041 use_extended_names(3X) function makes this information conditionally
1042 available to applications. The ncurses library provides the data leav‐
1043 ing most of the behavior to applications:
1044
1045 · User-defined capability strings whose name begins with “k” are
1046 treated as function keys.
1047
1048 · The types (boolean, number, string) determined by tic can be
1049 inferred by successful calls on tigetflag, etc.
1050
1051 · If the capability name happens to be two characters, the capability
1052 is also available through the termcap interface.
1053
1054 While termcap is said to be extensible because it does not use a prede‐
1055 fined set of capabilities, in practice it has been limited to the capa‐
1056 bilities defined by terminfo implementations. As a rule, user-defined
1057 capabilities intended for use by termcap applications should be limited
1058 to booleans and numbers to avoid running past the 1023 byte limit
1059 assumed by termcap implementations and their applications. In particu‐
1060 lar, providing extended sets of function keys (past the 60 numbered
1061 keys and the handful of special named keys) is best done using the
1062 longer names available using terminfo.
1063
1064 A Sample Entry
1065 The following entry, describing an ANSI-standard terminal, is represen‐
1066 tative of what a terminfo entry for a modern terminal typically looks
1067 like.
1068
1069 ansi|ansi/pc-term compatible with color,
1070 am, mc5i, mir, msgr,
1071 colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,
1072 acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260
1073 j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303
1074 u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,
1075 bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J,
1076 cr=^M, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B,
1077 cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,
1078 cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P,
1079 dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,
1080 el1=\E[1K, home=\E[H, hpa=\E[%i%p1%dG, ht=\E[I, hts=\EH,
1081 ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J,
1082 indn=\E[%p1%dS, invis=\E[8m, kbs=^H, kcbt=\E[Z, kcub1=\E[D,
1083 kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L,
1084 mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, op=\E[39;49m,
1085 rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rin=\E[%p1%dT,
1086 rmacs=\E[10m, rmpch=\E[10m, rmso=\E[m, rmul=\E[m,
1087 s0ds=\E(B, s1ds=\E)B, s2ds=\E*B, s3ds=\E+B,
1088 setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
1089 sgr=\E[0;10%?%p1%t;7%;
1090 %?%p2%t;4%;
1091 %?%p3%t;7%;
1092 %?%p4%t;5%;
1093 %?%p6%t;1%;
1094 %?%p7%t;8%;
1095 %?%p9%t;11%;m,
1096 sgr0=\E[0;10m, smacs=\E[11m, smpch=\E[11m, smso=\E[7m,
1097 smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
1098 u8=\E[?%[;0123456789]c, u9=\E[c, vpa=\E[%i%p1%dd,
1099
1100 Entries may continue onto multiple lines by placing white space at the
1101 beginning of each line except the first. Comments may be included on
1102 lines beginning with “#”. Capabilities in terminfo are of three types:
1103
1104 · Boolean capabilities which indicate that the terminal has some par‐
1105 ticular feature,
1106
1107 · numeric capabilities giving the size of the terminal or the size of
1108 particular delays, and
1109
1110 · string capabilities, which give a sequence which can be used to
1111 perform particular terminal operations.
1112
1113 Types of Capabilities
1114 All capabilities have names. For instance, the fact that ANSI-standard
1115 terminals have automatic margins (i.e., an automatic return and line-
1116 feed when the end of a line is reached) is indicated by the capability
1117 am. Hence the description of ansi includes am. Numeric capabilities
1118 are followed by the character “#” and then a positive value. Thus
1119 cols, which indicates the number of columns the terminal has, gives the
1120 value “80” for ansi. Values for numeric capabilities may be specified
1121 in decimal, octal or hexadecimal, using the C programming language con‐
1122 ventions (e.g., 255, 0377 and 0xff or 0xFF).
1123
1124 Finally, string valued capabilities, such as el (clear to end of line
1125 sequence) are given by the two-character code, an “=”, and then a
1126 string ending at the next following “,”.
1127
1128 A number of escape sequences are provided in the string valued capabil‐
1129 ities for easy encoding of characters there:
1130
1131 · Both \E and \e map to an ESCAPE character,
1132
1133 · ^x maps to a control-x for any appropriate x, and
1134
1135 · the sequences
1136
1137 \n, \l, \r, \t, \b, \f, and \s
1138
1139 produce
1140
1141 newline, line-feed, return, tab, backspace, form-feed, and space,
1142
1143 respectively.
1144
1145 X/Open Curses does not say what “appropriate x” might be. In practice,
1146 that is a printable ASCII graphic character. The special case “^?” is
1147 interpreted as DEL (127). In all other cases, the character value is
1148 AND'd with 0x1f, mapping to ASCII control codes in the range 0 through
1149 31.
1150
1151 Other escapes include
1152
1153 · \^ for ^,
1154
1155 · \\ for \,
1156
1157 · \, for comma,
1158
1159 · \: for :,
1160
1161 · and \0 for null.
1162
1163 \0 will produce \200, which does not terminate a string but behaves
1164 as a null character on most terminals, providing CS7 is specified.
1165 See stty(1).
1166
1167 The reason for this quirk is to maintain binary compatibility of
1168 the compiled terminfo files with other implementations, e.g., the
1169 SVr4 systems, which document this. Compiled terminfo files use
1170 null-terminated strings, with no lengths. Modifying this would
1171 require a new binary format, which would not work with other imple‐
1172 mentations.
1173
1174 Finally, characters may be given as three octal digits after a \.
1175
1176 A delay in milliseconds may appear anywhere in a string capability,
1177 enclosed in $<..> brackets, as in el=\EK$<5>, and padding characters
1178 are supplied by tputs(3X) to provide this delay.
1179
1180 · The delay must be a number with at most one decimal place of preci‐
1181 sion; it may be followed by suffixes “*” or “/” or both.
1182
1183 · A “*” indicates that the padding required is proportional to the
1184 number of lines affected by the operation, and the amount given is
1185 the per-affected-unit padding required. (In the case of insert
1186 character, the factor is still the number of lines affected.)
1187
1188 Normally, padding is advisory if the device has the xon capability;
1189 it is used for cost computation but does not trigger delays.
1190
1191 · A “/” suffix indicates that the padding is mandatory and forces a
1192 delay of the given number of milliseconds even on devices for which
1193 xon is present to indicate flow control.
1194
1195 Sometimes individual capabilities must be commented out. To do this,
1196 put a period before the capability name. For example, see the second
1197 ind in the example above.
1198
1199 Fetching Compiled Descriptions
1200 The ncurses library searches for terminal descriptions in several
1201 places. It uses only the first description found. The library has a
1202 compiled-in list of places to search which can be overridden by envi‐
1203 ronment variables. Before starting to search, ncurses eliminates
1204 duplicates in its search list.
1205
1206 · If the environment variable TERMINFO is set, it is interpreted as
1207 the pathname of a directory containing the compiled description you
1208 are working on. Only that directory is searched.
1209
1210 · If TERMINFO is not set, ncurses will instead look in the directory
1211 $HOME/.terminfo for a compiled description.
1212
1213 · Next, if the environment variable TERMINFO_DIRS is set, ncurses
1214 will interpret the contents of that variable as a list of colon-
1215 separated directories (or database files) to be searched.
1216
1217 An empty directory name (i.e., if the variable begins or ends with
1218 a colon, or contains adjacent colons) is interpreted as the system
1219 location /usr/share/terminfo.
1220
1221 · Finally, ncurses searches these compiled-in locations:
1222
1223 · a list of directories (no default value), and
1224
1225 · the system terminfo directory, /usr/share/terminfo (the com‐
1226 piled-in default).
1227
1228 Preparing Descriptions
1229 We now outline how to prepare descriptions of terminals. The most
1230 effective way to prepare a terminal description is by imitating the
1231 description of a similar terminal in terminfo and to build up a
1232 description gradually, using partial descriptions with vi or some other
1233 screen-oriented program to check that they are correct. Be aware that
1234 a very unusual terminal may expose deficiencies in the ability of the
1235 terminfo file to describe it or bugs in the screen-handling code of the
1236 test program.
1237
1238 To get the padding for insert line right (if the terminal manufacturer
1239 did not document it) a severe test is to edit a large file at 9600
1240 baud, delete 16 or so lines from the middle of the screen, then hit the
1241 “u” key several times quickly. If the terminal messes up, more padding
1242 is usually needed. A similar test can be used for insert character.
1243
1244 Basic Capabilities
1245 The number of columns on each line for the terminal is given by the
1246 cols numeric capability. If the terminal is a CRT, then the number of
1247 lines on the screen is given by the lines capability. If the terminal
1248 wraps around to the beginning of the next line when it reaches the
1249 right margin, then it should have the am capability. If the terminal
1250 can clear its screen, leaving the cursor in the home position, then
1251 this is given by the clear string capability. If the terminal over‐
1252 strikes (rather than clearing a position when a character is struck
1253 over) then it should have the os capability. If the terminal is a
1254 printing terminal, with no soft copy unit, give it both hc and os. (os
1255 applies to storage scope terminals, such as TEKTRONIX 4010 series, as
1256 well as hard copy and APL terminals.) If there is a code to move the
1257 cursor to the left edge of the current row, give this as cr. (Normally
1258 this will be carriage return, control M.) If there is a code to pro‐
1259 duce an audible signal (bell, beep, etc) give this as bel.
1260
1261 If there is a code to move the cursor one position to the left (such as
1262 backspace) that capability should be given as cub1. Similarly, codes
1263 to move to the right, up, and down should be given as cuf1, cuu1, and
1264 cud1. These local cursor motions should not alter the text they pass
1265 over, for example, you would not normally use “cuf1= ” because the
1266 space would erase the character moved over.
1267
1268 A very important point here is that the local cursor motions encoded in
1269 terminfo are undefined at the left and top edges of a CRT terminal.
1270 Programs should never attempt to backspace around the left edge, unless
1271 bw is given, and never attempt to go up locally off the top. In order
1272 to scroll text up, a program will go to the bottom left corner of the
1273 screen and send the ind (index) string.
1274
1275 To scroll text down, a program goes to the top left corner of the
1276 screen and sends the ri (reverse index) string. The strings ind and ri
1277 are undefined when not on their respective corners of the screen.
1278
1279 Parameterized versions of the scrolling sequences are indn and rin
1280 which have the same semantics as ind and ri except that they take one
1281 parameter, and scroll that many lines. They are also undefined except
1282 at the appropriate edge of the screen.
1283
1284 The am capability tells whether the cursor sticks at the right edge of
1285 the screen when text is output, but this does not necessarily apply to
1286 a cuf1 from the last column. The only local motion which is defined
1287 from the left edge is if bw is given, then a cub1 from the left edge
1288 will move to the right edge of the previous row. If bw is not given,
1289 the effect is undefined. This is useful for drawing a box around the
1290 edge of the screen, for example. If the terminal has switch selectable
1291 automatic margins, the terminfo file usually assumes that this is on;
1292 i.e., am. If the terminal has a command which moves to the first col‐
1293 umn of the next line, that command can be given as nel (newline). It
1294 does not matter if the command clears the remainder of the current
1295 line, so if the terminal has no cr and lf it may still be possible to
1296 craft a working nel out of one or both of them.
1297
1298 These capabilities suffice to describe hard-copy and “glass-tty” termi‐
1299 nals. Thus the model 33 teletype is described as
1300
1301 33|tty33|tty|model 33 teletype,
1302 bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,
1303
1304 while the Lear Siegler ADM-3 is described as
1305
1306 adm3|3|lsi adm3,
1307 am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
1308 ind=^J, lines#24,
1309
1310 Parameterized Strings
1311 Cursor addressing and other strings requiring parameters in the termi‐
1312 nal are described by a parameterized string capability, with printf-
1313 like escapes such as %x in it. For example, to address the cursor, the
1314 cup capability is given, using two parameters: the row and column to
1315 address to. (Rows and columns are numbered from zero and refer to the
1316 physical screen visible to the user, not to any unseen memory.) If the
1317 terminal has memory relative cursor addressing, that can be indicated
1318 by mrcup.
1319
1320 The parameter mechanism uses a stack and special % codes to manipulate
1321 it. Typically a sequence will push one of the parameters onto the
1322 stack and then print it in some format. Print (e.g., "%d") is a spe‐
1323 cial case. Other operations, including "%t" pop their operand from the
1324 stack. It is noted that more complex operations are often necessary,
1325 e.g., in the sgr string.
1326
1327 The % encodings have the following meanings:
1328
1329 %% outputs “%”
1330
1331 %[[:]flags][width[.precision]][doxXs]
1332 as in printf, flags are [-+#] and space. Use a “:” to allow the
1333 next character to be a “-” flag, avoiding interpreting "%-" as an
1334 operator.
1335
1336 %c print pop() like %c in printf
1337
1338 %s print pop() like %s in printf
1339
1340 %p[1-9]
1341 push i'th parameter
1342
1343 %P[a-z]
1344 set dynamic variable [a-z] to pop()
1345
1346 %g[a-z]/
1347 get dynamic variable [a-z] and push it
1348
1349 %P[A-Z]
1350 set static variable [a-z] to pop()
1351
1352 %g[A-Z]
1353 get static variable [a-z] and push it
1354
1355 The terms "static" and "dynamic" are misleading. Historically,
1356 these are simply two different sets of variables, whose values are
1357 not reset between calls to tparm(3X). However, that fact is not
1358 documented in other implementations. Relying on it will adversely
1359 impact portability to other implementations.
1360
1361 %'c' char constant c
1362
1363 %{nn}
1364 integer constant nn
1365
1366 %l push strlen(pop)
1367
1368 %+, %-, %*, %/, %m
1369 arithmetic (%m is mod): push(pop() op pop())
1370
1371 %&, %|, %^
1372 bit operations (AND, OR and exclusive-OR): push(pop() op pop())
1373
1374 %=, %>, %<
1375 logical operations: push(pop() op pop())
1376
1377 %A, %O
1378 logical AND and OR operations (for conditionals)
1379
1380 %!, %~
1381 unary operations (logical and bit complement): push(op pop())
1382
1383 %i add 1 to first two parameters (for ANSI terminals)
1384
1385 %? expr %t thenpart %e elsepart %;
1386 This forms an if-then-else. The %e elsepart is optional. Usually
1387 the %? expr part pushes a value onto the stack, and %t pops it
1388 from the stack, testing if it is nonzero (true). If it is zero
1389 (false), control passes to the %e (else) part.
1390
1391 It is possible to form else-if's a la Algol 68:
1392 %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e %;
1393
1394 where ci are conditions, bi are bodies.
1395
1396 Use the -f option of tic or infocmp to see the structure of if-
1397 then-else's. Some strings, e.g., sgr can be very complicated when
1398 written on one line. The -f option splits the string into lines
1399 with the parts indented.
1400
1401 Binary operations are in postfix form with the operands in the usual
1402 order. That is, to get x-5 one would use "%gx%{5}%-". %P and %g vari‐
1403 ables are persistent across escape-string evaluations.
1404
1405 Consider the HP2645, which, to get to row 3 and column 12, needs to be
1406 sent \E&a12c03Y padded for 6 milliseconds. Note that the order of the
1407 rows and columns is inverted here, and that the row and column are
1408 printed as two digits. Thus its cup capability is
1409 “cup=6\E&%p2%2dc%p1%2dY”.
1410
1411 The Microterm ACT-IV needs the current row and column sent preceded by
1412 a ^T, with the row and column simply encoded in binary,
1413 “cup=^T%p1%c%p2%c”. Terminals which use “%c” need to be able to
1414 backspace the cursor (cub1), and to move the cursor up one line on the
1415 screen (cuu1). This is necessary because it is not always safe to
1416 transmit \n ^D and \r, as the system may change or discard them. (The
1417 library routines dealing with terminfo set tty modes so that tabs are
1418 never expanded, so \t is safe to send. This turns out to be essential
1419 for the Ann Arbor 4080.)
1420
1421 A final example is the LSI ADM-3a, which uses row and column offset by
1422 a blank character, thus “cup=\E=%p1%' '%+%c%p2%' '%+%c”. After sending
1423 “\E=”, this pushes the first parameter, pushes the ASCII value for a
1424 space (32), adds them (pushing the sum on the stack in place of the two
1425 previous values) and outputs that value as a character. Then the same
1426 is done for the second parameter. More complex arithmetic is possible
1427 using the stack.
1428
1429 Cursor Motions
1430 If the terminal has a fast way to home the cursor (to very upper left
1431 corner of screen) then this can be given as home; similarly a fast way
1432 of getting to the lower left-hand corner can be given as ll; this may
1433 involve going up with cuu1 from the home position, but a program should
1434 never do this itself (unless ll does) because it can make no assumption
1435 about the effect of moving up from the home position. Note that the
1436 home position is the same as addressing to (0,0): to the top left cor‐
1437 ner of the screen, not of memory. (Thus, the \EH sequence on HP termi‐
1438 nals cannot be used for home.)
1439
1440 If the terminal has row or column absolute cursor addressing, these can
1441 be given as single parameter capabilities hpa (horizontal position
1442 absolute) and vpa (vertical position absolute). Sometimes these are
1443 shorter than the more general two parameter sequence (as with the
1444 hp2645) and can be used in preference to cup. If there are parameter‐
1445 ized local motions (e.g., move n spaces to the right) these can be
1446 given as cud, cub, cuf, and cuu with a single parameter indicating how
1447 many spaces to move. These are primarily useful if the terminal does
1448 not have cup, such as the TEKTRONIX 4025.
1449
1450 If the terminal needs to be in a special mode when running a program
1451 that uses these capabilities, the codes to enter and exit this mode can
1452 be given as smcup and rmcup. This arises, for example, from terminals
1453 like the Concept with more than one page of memory. If the terminal
1454 has only memory relative cursor addressing and not screen relative cur‐
1455 sor addressing, a one screen-sized window must be fixed into the termi‐
1456 nal for cursor addressing to work properly. This is also used for the
1457 TEKTRONIX 4025, where smcup sets the command character to be the one
1458 used by terminfo. If the smcup sequence will not restore the screen
1459 after an rmcup sequence is output (to the state prior to outputting
1460 rmcup), specify nrrmc.
1461
1462 Area Clears
1463 If the terminal can clear from the current position to the end of the
1464 line, leaving the cursor where it is, this should be given as el. If
1465 the terminal can clear from the beginning of the line to the current
1466 position inclusive, leaving the cursor where it is, this should be
1467 given as el1. If the terminal can clear from the current position to
1468 the end of the display, then this should be given as ed. Ed is only
1469 defined from the first column of a line. (Thus, it can be simulated by
1470 a request to delete a large number of lines, if a true ed is not avail‐
1471 able.)
1472
1473 Insert/delete line and vertical motions
1474 If the terminal can open a new blank line before the line where the
1475 cursor is, this should be given as il1; this is done only from the
1476 first position of a line. The cursor must then appear on the newly
1477 blank line. If the terminal can delete the line which the cursor is
1478 on, then this should be given as dl1; this is done only from the first
1479 position on the line to be deleted. Versions of il1 and dl1 which take
1480 a single parameter and insert or delete that many lines can be given as
1481 il and dl.
1482
1483 If the terminal has a settable scrolling region (like the vt100) the
1484 command to set this can be described with the csr capability, which
1485 takes two parameters: the top and bottom lines of the scrolling region.
1486 The cursor position is, alas, undefined after using this command.
1487
1488 It is possible to get the effect of insert or delete line using csr on
1489 a properly chosen region; the sc and rc (save and restore cursor) com‐
1490 mands may be useful for ensuring that your synthesized insert/delete
1491 string does not move the cursor. (Note that the ncurses(3X) library
1492 does this synthesis automatically, so you need not compose
1493 insert/delete strings for an entry with csr).
1494
1495 Yet another way to construct insert and delete might be to use a combi‐
1496 nation of index with the memory-lock feature found on some terminals
1497 (like the HP-700/90 series, which however also has insert/delete).
1498
1499 Inserting lines at the top or bottom of the screen can also be done
1500 using ri or ind on many terminals without a true insert/delete line,
1501 and is often faster even on terminals with those features.
1502
1503 The boolean non_dest_scroll_region should be set if each scrolling win‐
1504 dow is effectively a view port on a screen-sized canvas. To test for
1505 this capability, create a scrolling region in the middle of the screen,
1506 write something to the bottom line, move the cursor to the top of the
1507 region, and do ri followed by dl1 or ind. If the data scrolled off the
1508 bottom of the region by the ri re-appears, then scrolling is non-
1509 destructive. System V and XSI Curses expect that ind, ri, indn, and
1510 rin will simulate destructive scrolling; their documentation cautions
1511 you not to define csr unless this is true. This curses implementation
1512 is more liberal and will do explicit erases after scrolling if ndsrc is
1513 defined.
1514
1515 If the terminal has the ability to define a window as part of memory,
1516 which all commands affect, it should be given as the parameterized
1517 string wind. The four parameters are the starting and ending lines in
1518 memory and the starting and ending columns in memory, in that order.
1519
1520 If the terminal can retain display memory above, then the da capability
1521 should be given; if display memory can be retained below, then db
1522 should be given. These indicate that deleting a line or scrolling may
1523 bring non-blank lines up from below or that scrolling back with ri may
1524 bring down non-blank lines.
1525
1526 Insert/Delete Character
1527 There are two basic kinds of intelligent terminals with respect to
1528 insert/delete character which can be described using terminfo. The
1529 most common insert/delete character operations affect only the charac‐
1530 ters on the current line and shift characters off the end of the line
1531 rigidly. Other terminals, such as the Concept 100 and the Perkin Elmer
1532 Owl, make a distinction between typed and untyped blanks on the screen,
1533 shifting upon an insert or delete only to an untyped blank on the
1534 screen which is either eliminated, or expanded to two untyped blanks.
1535
1536 You can determine the kind of terminal you have by clearing the screen
1537 and then typing text separated by cursor motions. Type “abc def”
1538 using local cursor motions (not spaces) between the “abc” and the
1539 “def”. Then position the cursor before the “abc” and put the terminal
1540 in insert mode. If typing characters causes the rest of the line to
1541 shift rigidly and characters to fall off the end, then your terminal
1542 does not distinguish between blanks and untyped positions. If the
1543 “abc” shifts over to the “def” which then move together around the end
1544 of the current line and onto the next as you insert, you have the sec‐
1545 ond type of terminal, and should give the capability in, which stands
1546 for “insert null”.
1547
1548 While these are two logically separate attributes (one line versus
1549 multi-line insert mode, and special treatment of untyped spaces) we
1550 have seen no terminals whose insert mode cannot be described with the
1551 single attribute.
1552
1553 Terminfo can describe both terminals which have an insert mode, and
1554 terminals which send a simple sequence to open a blank position on the
1555 current line. Give as smir the sequence to get into insert mode. Give
1556 as rmir the sequence to leave insert mode. Now give as ich1 any
1557 sequence needed to be sent just before sending the character to be
1558 inserted. Most terminals with a true insert mode will not give ich1;
1559 terminals which send a sequence to open a screen position should give
1560 it here.
1561
1562 If your terminal has both, insert mode is usually preferable to ich1.
1563 Technically, you should not give both unless the terminal actually
1564 requires both to be used in combination. Accordingly, some non-curses
1565 applications get confused if both are present; the symptom is doubled
1566 characters in an update using insert. This requirement is now rare;
1567 most ich sequences do not require previous smir, and most smir insert
1568 modes do not require ich1 before each character. Therefore, the new
1569 curses actually assumes this is the case and uses either rmir/smir or
1570 ich/ich1 as appropriate (but not both). If you have to write an entry
1571 to be used under new curses for a terminal old enough to need both,
1572 include the rmir/smir sequences in ich1.
1573
1574 If post insert padding is needed, give this as a number of milliseconds
1575 in ip (a string option). Any other sequence which may need to be sent
1576 after an insert of a single character may also be given in ip. If your
1577 terminal needs both to be placed into an “insert mode” and a special
1578 code to precede each inserted character, then both smir/rmir and ich1
1579 can be given, and both will be used. The ich capability, with one
1580 parameter, n, will repeat the effects of ich1 n times.
1581
1582 If padding is necessary between characters typed while not in insert
1583 mode, give this as a number of milliseconds padding in rmp.
1584
1585 It is occasionally necessary to move around while in insert mode to
1586 delete characters on the same line (e.g., if there is a tab after the
1587 insertion position). If your terminal allows motion while in insert
1588 mode you can give the capability mir to speed up inserting in this
1589 case. Omitting mir will affect only speed. Some terminals (notably
1590 Datamedia's) must not have mir because of the way their insert mode
1591 works.
1592
1593 Finally, you can specify dch1 to delete a single character, dch with
1594 one parameter, n, to delete n characters, and delete mode by giving
1595 smdc and rmdc to enter and exit delete mode (any mode the terminal
1596 needs to be placed in for dch1 to work).
1597
1598 A command to erase n characters (equivalent to outputting n blanks
1599 without moving the cursor) can be given as ech with one parameter.
1600
1601 Highlighting, Underlining, and Visible Bells
1602 If your terminal has one or more kinds of display attributes, these can
1603 be represented in a number of different ways. You should choose one
1604 display form as standout mode, representing a good, high contrast,
1605 easy-on-the-eyes, format for highlighting error messages and other
1606 attention getters. (If you have a choice, reverse video plus half-
1607 bright is good, or reverse video alone.) The sequences to enter and
1608 exit standout mode are given as smso and rmso, respectively. If the
1609 code to change into or out of standout mode leaves one or even two
1610 blank spaces on the screen, as the TVI 912 and Teleray 1061 do, then
1611 xmc should be given to tell how many spaces are left.
1612
1613 Codes to begin underlining and end underlining can be given as smul and
1614 rmul respectively. If the terminal has a code to underline the current
1615 character and move the cursor one space to the right, such as the
1616 Microterm Mime, this can be given as uc.
1617
1618 Other capabilities to enter various highlighting modes include blink
1619 (blinking) bold (bold or extra bright) dim (dim or half-bright) invis
1620 (blanking or invisible text) prot (protected) rev (reverse video) sgr0
1621 (turn off all attribute modes) smacs (enter alternate character set
1622 mode) and rmacs (exit alternate character set mode). Turning on any of
1623 these modes singly may or may not turn off other modes.
1624
1625 If there is a sequence to set arbitrary combinations of modes, this
1626 should be given as sgr (set attributes), taking 9 parameters. Each
1627 parameter is either 0 or nonzero, as the corresponding attribute is on
1628 or off. The 9 parameters are, in order: standout, underline, reverse,
1629 blink, dim, bold, blank, protect, alternate character set. Not all
1630 modes need be supported by sgr, only those for which corresponding sep‐
1631 arate attribute commands exist.
1632
1633 For example, the DEC vt220 supports most of the modes:
1634
1635 tparm parameter attribute escape sequence
1636
1637 none none \E[0m
1638 p1 standout \E[0;1;7m
1639 p2 underline \E[0;4m
1640 p3 reverse \E[0;7m
1641 p4 blink \E[0;5m
1642 p5 dim not available
1643 p6 bold \E[0;1m
1644 p7 invis \E[0;8m
1645 p8 protect not used
1646 p9 altcharset ^O (off) ^N (on)
1647
1648 We begin each escape sequence by turning off any existing modes, since
1649 there is no quick way to determine whether they are active. Standout
1650 is set up to be the combination of reverse and bold. The vt220 termi‐
1651 nal has a protect mode, though it is not commonly used in sgr because
1652 it protects characters on the screen from the host's erasures. The
1653 altcharset mode also is different in that it is either ^O or ^N,
1654 depending on whether it is off or on. If all modes are turned on, the
1655 resulting sequence is \E[0;1;4;5;7;8m^N.
1656
1657 Some sequences are common to different modes. For example, ;7 is out‐
1658 put when either p1 or p3 is true, that is, if either standout or
1659 reverse modes are turned on.
1660
1661 Writing out the above sequences, along with their dependencies yields
1662
1663 sequence when to output terminfo translation
1664
1665 \E[0 always \E[0
1666 ;1 if p1 or p6 %?%p1%p6%|%t;1%;
1667 ;4 if p2 %?%p2%|%t;4%;
1668 ;5 if p4 %?%p4%|%t;5%;
1669 ;7 if p1 or p3 %?%p1%p3%|%t;7%;
1670 ;8 if p7 %?%p7%|%t;8%;
1671 m always m
1672 ^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%;
1673
1674 Putting this all together into the sgr sequence gives:
1675
1676 sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%;
1677 %?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
1678
1679 Remember that if you specify sgr, you must also specify sgr0. Also,
1680 some implementations rely on sgr being given if sgr0 is, Not all ter‐
1681 minfo entries necessarily have an sgr string, however. Many terminfo
1682 entries are derived from termcap entries which have no sgr string. The
1683 only drawback to adding an sgr string is that termcap also assumes that
1684 sgr0 does not exit alternate character set mode.
1685
1686 Terminals with the “magic cookie” glitch (xmc) deposit special “cook‐
1687 ies” when they receive mode-setting sequences, which affect the display
1688 algorithm rather than having extra bits for each character. Some ter‐
1689 minals, such as the HP 2621, automatically leave standout mode when
1690 they move to a new line or the cursor is addressed. Programs using
1691 standout mode should exit standout mode before moving the cursor or
1692 sending a newline, unless the msgr capability, asserting that it is
1693 safe to move in standout mode, is present.
1694
1695 If the terminal has a way of flashing the screen to indicate an error
1696 quietly (a bell replacement) then this can be given as flash; it must
1697 not move the cursor.
1698
1699 If the cursor needs to be made more visible than normal when it is not
1700 on the bottom line (to make, for example, a non-blinking underline into
1701 an easier to find block or blinking underline) give this sequence as
1702 cvvis. If there is a way to make the cursor completely invisible, give
1703 that as civis. The capability cnorm should be given which undoes the
1704 effects of both of these modes.
1705
1706 If your terminal correctly generates underlined characters (with no
1707 special codes needed) even though it does not overstrike, then you
1708 should give the capability ul. If a character overstriking another
1709 leaves both characters on the screen, specify the capability os. If
1710 overstrikes are erasable with a blank, then this should be indicated by
1711 giving eo.
1712
1713 Keypad and Function Keys
1714 If the terminal has a keypad that transmits codes when the keys are
1715 pressed, this information can be given. Note that it is not possible
1716 to handle terminals where the keypad only works in local (this applies,
1717 for example, to the unshifted HP 2621 keys). If the keypad can be set
1718 to transmit or not transmit, give these codes as smkx and rmkx. Other‐
1719 wise the keypad is assumed to always transmit.
1720
1721 The codes sent by the left arrow, right arrow, up arrow, down arrow,
1722 and home keys can be given as kcub1, kcuf1, kcuu1, kcud1, and khome
1723 respectively. If there are function keys such as f0, f1, ..., f10, the
1724 codes they send can be given as kf0, kf1, ..., kf10. If these keys
1725 have labels other than the default f0 through f10, the labels can be
1726 given as lf0, lf1, ..., lf10.
1727
1728 The codes transmitted by certain other special keys can be given:
1729
1730 · kll (home down),
1731
1732 · kbs (backspace),
1733
1734 · ktbc (clear all tabs),
1735
1736 · kctab (clear the tab stop in this column),
1737
1738 · kclr (clear screen or erase key),
1739
1740 · kdch1 (delete character),
1741
1742 · kdl1 (delete line),
1743
1744 · krmir (exit insert mode),
1745
1746 · kel (clear to end of line),
1747
1748 · ked (clear to end of screen),
1749
1750 · kich1 (insert character or enter insert mode),
1751
1752 · kil1 (insert line),
1753
1754 · knp (next page),
1755
1756 · kpp (previous page),
1757
1758 · kind (scroll forward/down),
1759
1760 · kri (scroll backward/up),
1761
1762 · khts (set a tab stop in this column).
1763
1764 In addition, if the keypad has a 3 by 3 array of keys including the
1765 four arrow keys, the other five keys can be given as ka1, ka3, kb2,
1766 kc1, and kc3. These keys are useful when the effects of a 3 by 3
1767 directional pad are needed.
1768
1769 Strings to program function keys can be given as pfkey, pfloc, and pfx.
1770 A string to program screen labels should be specified as pln. Each of
1771 these strings takes two parameters: the function key number to program
1772 (from 0 to 10) and the string to program it with. Function key numbers
1773 out of this range may program undefined keys in a terminal dependent
1774 manner. The difference between the capabilities is that pfkey causes
1775 pressing the given key to be the same as the user typing the given
1776 string; pfloc causes the string to be executed by the terminal in
1777 local; and pfx causes the string to be transmitted to the computer.
1778
1779 The capabilities nlab, lw and lh define the number of programmable
1780 screen labels and their width and height. If there are commands to
1781 turn the labels on and off, give them in smln and rmln. smln is nor‐
1782 mally output after one or more pln sequences to make sure that the
1783 change becomes visible.
1784
1785 Tabs and Initialization
1786 If the terminal has hardware tabs, the command to advance to the next
1787 tab stop can be given as ht (usually control I). A “back-tab” command
1788 which moves leftward to the preceding tab stop can be given as cbt. By
1789 convention, if the teletype modes indicate that tabs are being expanded
1790 by the computer rather than being sent to the terminal, programs should
1791 not use ht or cbt even if they are present, since the user may not have
1792 the tab stops properly set. If the terminal has hardware tabs which
1793 are initially set every n spaces when the terminal is powered up, the
1794 numeric parameter it is given, showing the number of spaces the tabs
1795 are set to. This is normally used by the tset command to determine
1796 whether to set the mode for hardware tab expansion, and whether to set
1797 the tab stops. If the terminal has tab stops that can be saved in non-
1798 volatile memory, the terminfo description can assume that they are
1799 properly set.
1800
1801 Other capabilities include is1, is2, and is3, initialization strings
1802 for the terminal, iprog, the path name of a program to be run to ini‐
1803 tialize the terminal, and if, the name of a file containing long ini‐
1804 tialization strings. These strings are expected to set the terminal
1805 into modes consistent with the rest of the terminfo description. They
1806 are normally sent to the terminal, by the init option of the tput pro‐
1807 gram, each time the user logs in. They will be printed in the follow‐
1808 ing order:
1809
1810 run the program
1811 iprog
1812
1813 output is1 is2
1814
1815 set the margins using
1816 mgc, smgl and smgr
1817
1818 set tabs using
1819 tbc and hts
1820
1821 print the file
1822 if
1823
1824 and finally
1825 output is3.
1826
1827 Most initialization is done with is2. Special terminal modes can be
1828 set up without duplicating strings by putting the common sequences in
1829 is2 and special cases in is1 and is3.
1830
1831 A set of sequences that does a harder reset from a totally unknown
1832 state can be given as rs1, rs2, rf and rs3, analogous to is1 , is2 , if
1833 and is3 respectively. These strings are output by the reset program,
1834 which is used when the terminal gets into a wedged state. Commands are
1835 normally placed in rs1, rs2 rs3 and rf only if they produce annoying
1836 effects on the screen and are not necessary when logging in. For exam‐
1837 ple, the command to set the vt100 into 80-column mode would normally be
1838 part of is2, but it causes an annoying glitch of the screen and is not
1839 normally needed since the terminal is usually already in 80 column
1840 mode.
1841
1842 The reset program writes strings including iprog, etc., in the same
1843 order as the init program, using rs1, etc., instead of is1, etc. If
1844 any of rs1, rs2, rs3, or rf reset capability strings are missing, the
1845 reset program falls back upon the corresponding initialization capabil‐
1846 ity string.
1847
1848 If there are commands to set and clear tab stops, they can be given as
1849 tbc (clear all tab stops) and hts (set a tab stop in the current column
1850 of every row). If a more complex sequence is needed to set the tabs
1851 than can be described by this, the sequence can be placed in is2 or if.
1852
1853 Delays and Padding
1854 Many older and slower terminals do not support either XON/XOFF or DTR
1855 handshaking, including hard copy terminals and some very archaic CRTs
1856 (including, for example, DEC VT100s). These may require padding char‐
1857 acters after certain cursor motions and screen changes.
1858
1859 If the terminal uses xon/xoff handshaking for flow control (that is, it
1860 automatically emits ^S back to the host when its input buffers are
1861 close to full), set xon. This capability suppresses the emission of
1862 padding. You can also set it for memory-mapped console devices effec‐
1863 tively that do not have a speed limit. Padding information should
1864 still be included so that routines can make better decisions about rel‐
1865 ative costs, but actual pad characters will not be transmitted.
1866
1867 If pb (padding baud rate) is given, padding is suppressed at baud rates
1868 below the value of pb. If the entry has no padding baud rate, then
1869 whether padding is emitted or not is completely controlled by xon.
1870
1871 If the terminal requires other than a null (zero) character as a pad,
1872 then this can be given as pad. Only the first character of the pad
1873 string is used.
1874
1875 Status Lines
1876 Some terminals have an extra “status line” which is not normally used
1877 by software (and thus not counted in the terminal's lines capability).
1878
1879 The simplest case is a status line which is cursor-addressable but not
1880 part of the main scrolling region on the screen; the Heathkit H19 has a
1881 status line of this kind, as would a 24-line VT100 with a 23-line
1882 scrolling region set up on initialization. This situation is indicated
1883 by the hs capability.
1884
1885 Some terminals with status lines need special sequences to access the
1886 status line. These may be expressed as a string with single parameter
1887 tsl which takes the cursor to a given zero-origin column on the status
1888 line. The capability fsl must return to the main-screen cursor posi‐
1889 tions before the last tsl. You may need to embed the string values of
1890 sc (save cursor) and rc (restore cursor) in tsl and fsl to accomplish
1891 this.
1892
1893 The status line is normally assumed to be the same width as the width
1894 of the terminal. If this is untrue, you can specify it with the
1895 numeric capability wsl.
1896
1897 A command to erase or blank the status line may be specified as dsl.
1898
1899 The boolean capability eslok specifies that escape sequences, tabs,
1900 etc., work ordinarily in the status line.
1901
1902 The ncurses implementation does not yet use any of these capabilities.
1903 They are documented here in case they ever become important.
1904
1905 Line Graphics
1906 Many terminals have alternate character sets useful for forms-drawing.
1907 Terminfo and curses have built-in support for most of the drawing char‐
1908 acters supported by the VT100, with some characters from the AT&T
1909 4410v1 added. This alternate character set may be specified by the
1910 acsc capability.
1911
1912 Glyph ACS Ascii acsc acsc
1913 Name Name Default Char Value
1914 ────────────────────────────────────────────────────────────────────────
1915 arrow pointing right ACS_RARROW > + 0x2b
1916 arrow pointing left ACS_LARROW < , 0x2c
1917 arrow pointing up ACS_UARROW ^ - 0x2d
1918 arrow pointing down ACS_DARROW v . 0x2e
1919 solid square block ACS_BLOCK # 0 0x30
1920 diamond ACS_DIAMOND + ` 0x60
1921 checker board (stipple) ACS_CKBOARD : a 0x61
1922 degree symbol ACS_DEGREE \ f 0x66
1923 plus/minus ACS_PLMINUS # g 0x67
1924 board of squares ACS_BOARD # h 0x68
1925 lantern symbol ACS_LANTERN # i 0x69
1926
1927 lower right corner ACS_LRCORNER + j 0x6a
1928 upper right corner ACS_URCORNER + k 0x6b
1929 upper left corner ACS_ULCORNER + l 0x6c
1930 lower left corner ACS_LLCORNER + m 0x6d
1931 large plus or crossover ACS_PLUS + n 0x6e
1932 scan line 1 ACS_S1 ~ o 0x6f
1933 scan line 3 ACS_S3 - p 0x70
1934 horizontal line ACS_HLINE - q 0x71
1935 scan line 7 ACS_S7 - r 0x72
1936 scan line 9 ACS_S9 _ s 0x73
1937 tee pointing right ACS_LTEE + t 0x74
1938 tee pointing left ACS_RTEE + u 0x75
1939 tee pointing up ACS_BTEE + v 0x76
1940 tee pointing down ACS_TTEE + w 0x77
1941 vertical line ACS_VLINE | x 0x78
1942 less-than-or-equal-to ACS_LEQUAL < y 0x79
1943 greater-than-or-equal-to ACS_GEQUAL > z 0x7a
1944 greek pi ACS_PI * { 0x7b
1945 not-equal ACS_NEQUAL ! | 0x7c
1946 UK pound sign ACS_STERLING f } 0x7d
1947 bullet ACS_BULLET o ~ 0x7e
1948
1949 A few notes apply to the table itself:
1950
1951 · X/Open Curses incorrectly states that the mapping for lantern is
1952 uppercase “I” although Unix implementations use the lowercase “i”
1953 mapping.
1954
1955 · The DEC VT100 implemented graphics using the alternate character
1956 set feature, temporarily switching modes and sending characters in
1957 the range 0x60 (96) to 0x7e (126) (the acsc Value column in the ta‐
1958 ble).
1959
1960 · The AT&T terminal added graphics characters outside that range.
1961
1962 Some of the characters within the range do not match the VT100;
1963 presumably they were used in the AT&T terminal: board of squares
1964 replaces the VT100 newline symbol, while lantern symbol replaces
1965 the VT100 vertical tab symbol. The other VT100 symbols for control
1966 characters (horizontal tab, carriage return and line-feed) are not
1967 (re)used in curses.
1968
1969 The best way to define a new device's graphics set is to add a column
1970 to a copy of this table for your terminal, giving the character which
1971 (when emitted between smacs/rmacs switches) will be rendered as the
1972 corresponding graphic. Then read off the VT100/your terminal character
1973 pairs right to left in sequence; these become the ACSC string.
1974
1975 Color Handling
1976 The curses library functions init_pair and init_color manipulate the
1977 color pairs and color values discussed in this section (see
1978 curs_color(3X) for details on these and related functions).
1979
1980 Most color terminals are either “Tektronix-like” or “HP-like”:
1981
1982 · Tektronix-like terminals have a predefined set of N colors (where N
1983 is usually 8), and can set character-cell foreground and background
1984 characters independently, mixing them into N * N color-pairs.
1985
1986 · On HP-like terminals, the user must set each color pair up sepa‐
1987 rately (foreground and background are not independently settable).
1988 Up to M color-pairs may be set up from 2*M different colors. ANSI-
1989 compatible terminals are Tektronix-like.
1990
1991 Some basic color capabilities are independent of the color method. The
1992 numeric capabilities colors and pairs specify the maximum numbers of
1993 colors and color-pairs that can be displayed simultaneously. The op
1994 (original pair) string resets foreground and background colors to their
1995 default values for the terminal. The oc string resets all colors or
1996 color-pairs to their default values for the terminal. Some terminals
1997 (including many PC terminal emulators) erase screen areas with the cur‐
1998 rent background color rather than the power-up default background;
1999 these should have the boolean capability bce.
2000
2001 While the curses library works with color pairs (reflecting the inabil‐
2002 ity of some devices to set foreground and background colors indepen‐
2003 dently), there are separate capabilities for setting these features:
2004
2005 · To change the current foreground or background color on a Tek‐
2006 tronix-type terminal, use setaf (set ANSI foreground) and setab
2007 (set ANSI background) or setf (set foreground) and setb (set back‐
2008 ground). These take one parameter, the color number. The SVr4
2009 documentation describes only setaf/setab; the XPG4 draft says that
2010 "If the terminal supports ANSI escape sequences to set background
2011 and foreground, they should be coded as setaf and setab, respec‐
2012 tively.
2013
2014 · If the terminal supports other escape sequences to set background
2015 and foreground, they should be coded as setf and setb, respec‐
2016 tively. The vidputs and the refresh(3X) functions use the setaf
2017 and setab capabilities if they are defined.
2018
2019 The setaf/setab and setf/setb capabilities take a single numeric argu‐
2020 ment each. Argument values 0-7 of setaf/setab are portably defined as
2021 follows (the middle column is the symbolic #define available in the
2022 header for the curses or ncurses libraries). The terminal hardware is
2023 free to map these as it likes, but the RGB values indicate normal loca‐
2024 tions in color space.
2025
2026 Color #define Value RGB
2027 black COLOR_BLACK 0 0, 0, 0
2028 red COLOR_RED 1 max,0,0
2029 green COLOR_GREEN 2 0,max,0
2030 yellow COLOR_YELLOW 3 max,max,0
2031 blue COLOR_BLUE 4 0,0,max
2032 magenta COLOR_MAGENTA 5 max,0,max
2033 cyan COLOR_CYAN 6 0,max,max
2034 white COLOR_WHITE 7 max,max,max
2035
2036 The argument values of setf/setb historically correspond to a different
2037 mapping, i.e.,
2038
2039 Color #define Value RGB
2040 black COLOR_BLACK 0 0, 0, 0
2041 blue COLOR_BLUE 1 0,0,max
2042 green COLOR_GREEN 2 0,max,0
2043 cyan COLOR_CYAN 3 0,max,max
2044 red COLOR_RED 4 max,0,0
2045 magenta COLOR_MAGENTA 5 max,0,max
2046 yellow COLOR_YELLOW 6 max,max,0
2047 white COLOR_WHITE 7 max,max,max
2048
2049 It is important to not confuse the two sets of color capabilities; oth‐
2050 erwise red/blue will be interchanged on the display.
2051
2052 On an HP-like terminal, use scp with a color-pair number parameter to
2053 set which color pair is current.
2054
2055 Some terminals allow the color values to be modified:
2056
2057 · On a Tektronix-like terminal, the capability ccc may be present to
2058 indicate that colors can be modified. If so, the initc capability
2059 will take a color number (0 to colors - 1)and three more parameters
2060 which describe the color. These three parameters default to being
2061 interpreted as RGB (Red, Green, Blue) values. If the boolean capa‐
2062 bility hls is present, they are instead as HLS (Hue, Lightness,
2063 Saturation) indices. The ranges are terminal-dependent.
2064
2065 · On an HP-like terminal, initp may give a capability for changing a
2066 color-pair value. It will take seven parameters; a color-pair num‐
2067 ber (0 to max_pairs - 1), and two triples describing first back‐
2068 ground and then foreground colors. These parameters must be (Red,
2069 Green, Blue) or (Hue, Lightness, Saturation) depending on hls.
2070
2071 On some color terminals, colors collide with highlights. You can reg‐
2072 ister these collisions with the ncv capability. This is a bit-mask of
2073 attributes not to be used when colors are enabled. The correspondence
2074 with the attributes understood by curses is as follows:
2075
2076 Attribute Bit Decimal Set by
2077 A_STANDOUT 0 1 sgr
2078 A_UNDERLINE 1 2 sgr
2079 A_REVERSE 2 4 sgr
2080 A_BLINK 3 8 sgr
2081 A_DIM 4 16 sgr
2082 A_BOLD 5 32 sgr
2083 A_INVIS 6 64 sgr
2084 A_PROTECT 7 128 sgr
2085 A_ALTCHARSET 8 256 sgr
2086 A_HORIZONTAL 9 512 sgr1
2087 A_LEFT 10 1024 sgr1
2088 A_LOW 11 2048 sgr1
2089 A_RIGHT 12 4096 sgr1
2090 A_TOP 13 8192 sgr1
2091 A_VERTICAL 14 16384 sgr1
2092 A_ITALIC 15 32768 sitm
2093
2094 For example, on many IBM PC consoles, the underline attribute collides
2095 with the foreground color blue and is not available in color mode.
2096 These should have an ncv capability of 2.
2097
2098 SVr4 curses does nothing with ncv, ncurses recognizes it and optimizes
2099 the output in favor of colors.
2100
2101 Miscellaneous
2102 If the terminal requires other than a null (zero) character as a pad,
2103 then this can be given as pad. Only the first character of the pad
2104 string is used. If the terminal does not have a pad character, specify
2105 npc. Note that ncurses implements the termcap-compatible PC variable;
2106 though the application may set this value to something other than a
2107 null, ncurses will test npc first and use napms if the terminal has no
2108 pad character.
2109
2110 If the terminal can move up or down half a line, this can be indicated
2111 with hu (half-line up) and hd (half-line down). This is primarily use‐
2112 ful for superscripts and subscripts on hard-copy terminals. If a hard-
2113 copy terminal can eject to the next page (form feed), give this as ff
2114 (usually control L).
2115
2116 If there is a command to repeat a given character a given number of
2117 times (to save time transmitting a large number of identical charac‐
2118 ters) this can be indicated with the parameterized string rep. The
2119 first parameter is the character to be repeated and the second is the
2120 number of times to repeat it. Thus, tparm(repeat_char, 'x', 10) is the
2121 same as “xxxxxxxxxx”.
2122
2123 If the terminal has a settable command character, such as the TEKTRONIX
2124 4025, this can be indicated with cmdch. A prototype command character
2125 is chosen which is used in all capabilities. This character is given
2126 in the cmdch capability to identify it. The following convention is
2127 supported on some UNIX systems: The environment is to be searched for a
2128 CC variable, and if found, all occurrences of the prototype character
2129 are replaced with the character in the environment variable.
2130
2131 Terminal descriptions that do not represent a specific kind of known
2132 terminal, such as switch, dialup, patch, and network, should include
2133 the gn (generic) capability so that programs can complain that they do
2134 not know how to talk to the terminal. (This capability does not apply
2135 to virtual terminal descriptions for which the escape sequences are
2136 known.)
2137
2138 If the terminal has a “meta key” which acts as a shift key, setting the
2139 8th bit of any character transmitted, this fact can be indicated with
2140 km. Otherwise, software will assume that the 8th bit is parity and it
2141 will usually be cleared. If strings exist to turn this “meta mode” on
2142 and off, they can be given as smm and rmm.
2143
2144 If the terminal has more lines of memory than will fit on the screen at
2145 once, the number of lines of memory can be indicated with lm. A value
2146 of lm#0 indicates that the number of lines is not fixed, but that there
2147 is still more memory than fits on the screen.
2148
2149 If the terminal is one of those supported by the UNIX virtual terminal
2150 protocol, the terminal number can be given as vt.
2151
2152 Media copy strings which control an auxiliary printer connected to the
2153 terminal can be given as mc0: print the contents of the screen, mc4:
2154 turn off the printer, and mc5: turn on the printer. When the printer
2155 is on, all text sent to the terminal will be sent to the printer. It
2156 is undefined whether the text is also displayed on the terminal screen
2157 when the printer is on. A variation mc5p takes one parameter, and
2158 leaves the printer on for as many characters as the value of the param‐
2159 eter, then turns the printer off. The parameter should not exceed 255.
2160 All text, including mc4, is transparently passed to the printer while
2161 an mc5p is in effect.
2162
2163 Glitches and Braindamage
2164 Hazeltine terminals, which do not allow “~” characters to be displayed
2165 should indicate hz.
2166
2167 Terminals which ignore a line-feed immediately after an am wrap, such
2168 as the Concept and vt100, should indicate xenl.
2169
2170 If el is required to get rid of standout (instead of merely writing
2171 normal text on top of it), xhp should be given.
2172
2173 Teleray terminals, where tabs turn all characters moved over to blanks,
2174 should indicate xt (destructive tabs). Note: the variable indicating
2175 this is now “dest_tabs_magic_smso”; in older versions, it was tel‐
2176 eray_glitch. This glitch is also taken to mean that it is not possible
2177 to position the cursor on top of a “magic cookie”, that to erase stand‐
2178 out mode it is instead necessary to use delete and insert line. The
2179 ncurses implementation ignores this glitch.
2180
2181 The Beehive Superbee, which is unable to correctly transmit the escape
2182 or control C characters, has xsb, indicating that the f1 key is used
2183 for escape and f2 for control C. (Only certain Superbees have this
2184 problem, depending on the ROM.) Note that in older terminfo versions,
2185 this capability was called “beehive_glitch”; it is now “no_esc_ctl_c”.
2186
2187 Other specific terminal problems may be corrected by adding more capa‐
2188 bilities of the form xx.
2189
2190 Pitfalls of Long Entries
2191 Long terminfo entries are unlikely to be a problem; to date, no entry
2192 has even approached terminfo's 4096-byte string-table maximum. Unfor‐
2193 tunately, the termcap translations are much more strictly limited (to
2194 1023 bytes), thus termcap translations of long terminfo entries can
2195 cause problems.
2196
2197 The man pages for 4.3BSD and older versions of tgetent instruct the
2198 user to allocate a 1024-byte buffer for the termcap entry. The entry
2199 gets null-terminated by the termcap library, so that makes the maximum
2200 safe length for a termcap entry 1k-1 (1023) bytes. Depending on what
2201 the application and the termcap library being used does, and where in
2202 the termcap file the terminal type that tgetent is searching for is,
2203 several bad things can happen.
2204
2205 Some termcap libraries print a warning message or exit if they find an
2206 entry that's longer than 1023 bytes; others do not; others truncate the
2207 entries to 1023 bytes. Some application programs allocate more than
2208 the recommended 1K for the termcap entry; others do not.
2209
2210 Each termcap entry has two important sizes associated with it: before
2211 "tc" expansion, and after "tc" expansion. "tc" is the capability that
2212 tacks on another termcap entry to the end of the current one, to add on
2213 its capabilities. If a termcap entry does not use the "tc" capability,
2214 then of course the two lengths are the same.
2215
2216 The "before tc expansion" length is the most important one, because it
2217 affects more than just users of that particular terminal. This is the
2218 length of the entry as it exists in /etc/termcap, minus the backslash-
2219 newline pairs, which tgetent strips out while reading it. Some termcap
2220 libraries strip off the final newline, too (GNU termcap does not). Now
2221 suppose:
2222
2223 · a termcap entry before expansion is more than 1023 bytes long,
2224
2225 · and the application has only allocated a 1k buffer,
2226
2227 · and the termcap library (like the one in BSD/OS 1.1 and GNU) reads
2228 the whole entry into the buffer, no matter what its length, to see
2229 if it is the entry it wants,
2230
2231 · and tgetent is searching for a terminal type that either is the
2232 long entry, appears in the termcap file after the long entry, or
2233 does not appear in the file at all (so that tgetent has to search
2234 the whole termcap file).
2235
2236 Then tgetent will overwrite memory, perhaps its stack, and probably
2237 core dump the program. Programs like telnet are particularly vulnera‐
2238 ble; modern telnets pass along values like the terminal type automati‐
2239 cally. The results are almost as undesirable with a termcap library,
2240 like SunOS 4.1.3 and Ultrix 4.4, that prints warning messages when it
2241 reads an overly long termcap entry. If a termcap library truncates
2242 long entries, like OSF/1 3.0, it is immune to dying here but will
2243 return incorrect data for the terminal.
2244
2245 The "after tc expansion" length will have a similar effect to the
2246 above, but only for people who actually set TERM to that terminal type,
2247 since tgetent only does "tc" expansion once it is found the terminal
2248 type it was looking for, not while searching.
2249
2250 In summary, a termcap entry that is longer than 1023 bytes can cause,
2251 on various combinations of termcap libraries and applications, a core
2252 dump, warnings, or incorrect operation. If it is too long even before
2253 "tc" expansion, it will have this effect even for users of some other
2254 terminal types and users whose TERM variable does not have a termcap
2255 entry.
2256
2257 When in -C (translate to termcap) mode, the ncurses implementation of
2258 tic(1M) issues warning messages when the pre-tc length of a termcap
2259 translation is too long. The -c (check) option also checks resolved
2260 (after tc expansion) lengths.
2261
2262 Binary Compatibility
2263 It is not wise to count on portability of binary terminfo entries
2264 between commercial UNIX versions. The problem is that there are at
2265 least two versions of terminfo (under HP-UX and AIX) which diverged
2266 from System V terminfo after SVr1, and have added extension capabili‐
2267 ties to the string table that (in the binary format) collide with Sys‐
2268 tem V and XSI Curses extensions.
2269
2271 Searching for terminal descriptions in $HOME/.terminfo and TER‐
2272 MINFO_DIRS is not supported by older implementations.
2273
2274 Some SVr4 curses implementations, and all previous to SVr4, do not
2275 interpret the %A and %O operators in parameter strings.
2276
2277 SVr4/XPG4 do not specify whether msgr licenses movement while in an
2278 alternate-character-set mode (such modes may, among other things, map
2279 CR and NL to characters that do not trigger local motions). The
2280 ncurses implementation ignores msgr in ALTCHARSET mode. This raises
2281 the possibility that an XPG4 implementation making the opposite inter‐
2282 pretation may need terminfo entries made for ncurses to have msgr
2283 turned off.
2284
2285 The ncurses library handles insert-character and insert-character modes
2286 in a slightly non-standard way to get better update efficiency. See
2287 the Insert/Delete Character subsection above.
2288
2289 The parameter substitutions for set_clock and display_clock are not
2290 documented in SVr4 or the XSI Curses standard. They are deduced from
2291 the documentation for the AT&T 505 terminal.
2292
2293 Be careful assigning the kmous capability. The ncurses library wants
2294 to interpret it as KEY_MOUSE, for use by terminals and emulators like
2295 xterm that can return mouse-tracking information in the keyboard-input
2296 stream.
2297
2298 X/Open Curses does not mention italics. Portable applications must
2299 assume that numeric capabilities are signed 16-bit values. This
2300 includes the no_color_video (ncv) capability. The 32768 mask value
2301 used for italics with ncv can be confused with an absent or cancelled
2302 ncv. If italics should work with colors, then the ncv value must be
2303 specified, even if it is zero.
2304
2305 Different commercial ports of terminfo and curses support different
2306 subsets of the XSI Curses standard and (in some cases) different exten‐
2307 sion sets. Here is a summary, accurate as of October 1995:
2308
2309 · SVR4, Solaris, ncurses -- These support all SVr4 capabilities.
2310
2311 · SGI -- Supports the SVr4 set, adds one undocumented extended string
2312 capability (set_pglen).
2313
2314 · SVr1, Ultrix -- These support a restricted subset of terminfo capa‐
2315 bilities. The booleans end with xon_xoff; the numerics with
2316 width_status_line; and the strings with prtr_non.
2317
2318 · HP/UX -- Supports the SVr1 subset, plus the SVr[234] numerics
2319 num_labels, label_height, label_width, plus function keys 11
2320 through 63, plus plab_norm, label_on, and label_off, plus some
2321 incompatible extensions in the string table.
2322
2323 · AIX -- Supports the SVr1 subset, plus function keys 11 through 63,
2324 plus a number of incompatible string table extensions.
2325
2326 · OSF -- Supports both the SVr4 set and the AIX extensions.
2327
2329 /usr/share/terminfo/?/* files containing terminal descriptions
2330
2332 tic(1M), infocmp(1M), curses(3X), curs_color(3X), printf(3), term(5).
2333 term_variables(3X). user_caps(5).
2334
2336 Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey. Based on pcurses
2337 by Pavel Curtis.
2338
2339
2340
2341 terminfo(5)