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