1terminfo(4) File Formats terminfo(4)
2
3
4
6 terminfo - terminal and printer capability database
7
9 /usr/share/lib/terminfo/?/*
10
11
13 The terminfo database describes the capabilities of devices such as
14 terminals and printers. Devices are described in terminfo source files
15 by specifying a set of capabilities, by quantifying certain aspects of
16 the device, and by specifying character sequences that affect particu‐
17 lar results. This database is often used by screen oriented applica‐
18 tions such as vi and curses-based programs, as well as by some system
19 commands such as ls and more. This usage allows them to work with a
20 variety of devices without changes to the programs.
21
22
23 terminfo descriptions are located in the directory pointed to by the
24 environment variable TERMINFO or in /usr/share/lib/terminfo. terminfo
25 descriptions are generated by tic(1M).
26
27
28 terminfo source files consist of one or more device descriptions. Each
29 description consists of a header (beginning in column 1) and one or
30 more lines that list the features for that particular device. Every
31 line in a terminfo source file must end in a comma (,). Every line in a
32 terminfo source file except the header must be indented with one or
33 more white spaces (either spaces or tabs).
34
35
36 Entries in terminfo source files consist of a number of comma-separated
37 fields. White space after each comma is ignored. Embedded commas must
38 be escaped by using a backslash. Each device entry has the following
39 format:
40
41 alias1 | alias2 | ... | aliasn | fullname,
42 capability1, capability2,
43 .
44 .
45 .
46 capabilityn,
47
48
49
50
51 The first line, commonly referred to as the header line, must begin in
52 column one and must contain at least two aliases separated by vertical
53 bars. The last field in the header line must be the long name of the
54 device and it may contain any string. Alias names must be unique in the
55 terminfo database and they must conform to system file naming conven‐
56 tions. See tic(1M). They cannot, for example, contain white space or
57 slashes.
58
59
60 Every device must be assigned a name, such as "vt100". Device names
61 (except the long name) should be chosen using the following conven‐
62 tions. The name should not contain hyphens because hyphens are
63 reserved for use when adding suffixes that indicate special modes.
64
65
66 These special modes may be modes that the hardware can be in, or user
67 preferences. To assign a special mode to a particular device, append a
68 suffix consisting of a hyphen and an indicator of the mode to the
69 device name. For example, the -w suffix means "wide mode". When speci‐
70 fied, it allows for a width of 132 columns instead of the standard 80
71 columns. Therefore, if you want to use a "vt100" device set to wide
72 mode, name the device "vt100-w". Use the following suffixes where pos‐
73 sible.
74
75
76
77
78 Suffix Meaning Example
79 -w Wide mode (more than 80 columns) 5410-w
80 -am With auto. margins (usually default) vt100-am
81 -nam Without automatic margins vt100-nam
82 -n Number of lines on the screen 2300-40
83 -na No arrow keys (leave them in local) c100-na
84 -np Number of pages of memory c100-4p
85 -rv Reverse video 4415-rv
86
87
88
89 The terminfo reference manual page is organized in two sections:
90
91 o PART 1: DEVICE CAPABILITIES
92
93 o PART 2: PRINTER CAPABILITIES
94
95 PART 1: DEVICE CAPABILITIES
96 Capabilities in terminfo are of three types: Boolean capabilities
97 (which show that a device has or does not have a particular feature),
98 numeric capabilities (which quantify particular features of a device),
99 and string capabilities (which provide sequences that can be used to
100 perform particular operations on devices).
101
102
103 In the following table, a Variable is the name by which a C programmer
104 accesses a capability (at the terminfo level). A Capname is the short
105 name for a capability specified in the terminfo source file. It is used
106 by a person updating the source file and by the tput command. A Termcap
107 Code is a two-letter sequence that corresponds to the termcap capabil‐
108 ity name. (Note that termcap is no longer supported.)
109
110
111 Capability names have no real length limit, but an informal limit of
112 five characters has been adopted to keep them short. Whenever possible,
113 capability names are chosen to be the same as or similar to those spec‐
114 ified by the ANSI X3.64-1979 standard. Semantics are also intended to
115 match those of the ANSI standard.
116
117
118 All string capabilities listed below may have padding specified, with
119 the exception of those used for input. Input capabilities, listed under
120 the Strings section in the following tables, have names beginning with
121 key_. The #i symbol in the description field of the following tables
122 refers to the ith parameter.
123
124 Booleans
125 ________________________________________________________________
126 Cap- Termcap
127 Variable name Code Description
128 ________________________________________________________________
129
130 auto_left_margin bw bw cub1 wraps from column 0 to
131 last column
132 auto_right_margin am am Terminal has automatic margins
133 back_color_erase bce be Screen erased with background
134 color
135 can_change ccc cc Terminal can re-define existing
136 color
137 ceol_standout_glitch xhp xs Standout not erased by
138 overwriting (hp)
139 col_addr_glitch xhpa YA Only positive motion
140 for hpa/mhpa caps
141 cpi_changes_res cpix YF Changing character pitch
142 changes resolution
143 cr_cancels_micro_mode crxm YB Using cr turns off micro mode
144 dest_tabs_magic_smso xt xt Destructive tabs, magic
145 smso char (t1061)
146 eat_newline_glitch xenl xn Newline ignored after
147 80 columns (Concept)
148 erase_overstrike eo eo Can erase overstrikes with a
149 blank
150 generic_type gn gn Generic line type
151 (for example, dialup, switch)
152 hard_copy hc hc Hardcopy terminal
153 hard_cursor chts HC Cursor is hard to see
154 has_meta_key km km Has a meta key (shift,
155 sets parity bit)
156 has_print_wheel daisy YC Printer needs operator
157 to change character set
158 has_status_line hs hs Has extra "status line"
159 hue_lightness_saturation hls hl Terminal uses only HLS
160 color notation (Tektronix)
161 insert_null_glitch in in Insert mode distinguishes nulls
162 lpi_changes_res lpix YG Changing line pitch
163 changes resolution
164 memory_above da da Display may be retained
165 above the screen
166 memory_below db db Display may be retained
167 below the screen
168 move_insert_mode mir mi Safe to move while in insert
169 mode
170 move_standout_mode msgr ms Safe to move in standout modes
171 needs_xon_xoff nxon nx Padding won't work,
172 xon/xoff required
173 no_esc_ctlc xsb xb Beehive (f1=escape, f2=ctrl C)
174 no_pad_char npc NP Pad character doesn't exist
175 non_dest_scroll_region ndscr ND Scrolling region
176 is nondestructive
177 non_rev_rmcup nrrmc NR smcup does not reverse rmcup
178 over_strike os os Terminal overstrikes
179 on hard-copy terminal
180 prtr_silent mc5i 5i Printer won't echo on screen
181 row_addr_glitch xvpa YD Only positive motion
182 for vpa/mvpa caps
183 semi_auto_right_margin sam YE Printing in last column causes
184 cr
185 status_line_esc_ok eslok es Escape can be used on
186 the status line
187 tilde_glitch hz hz Hazeltine; can't print tilde (~)
188 transparent_underline ul ul Underline character overstrikes
189 xon_xoff xon xo Terminal uses xon/xoff
190 handshaking
191
192
193
194 Numbers
195 ________________________________________________________________
196 Cap- Termcap
197 Variable name Code Description
198 ________________________________________________________________
199
200 bit_image_entwining bitwin Yo Number of passes for each
201 bit-map row
202 bit_image_type bitype Yp Type of bit image device
203 buffer_capacity bufsz Ya Number of bytes buffered
204 before printing
205 buttons btns BT Number of buttons on the mouse
206 columns cols co Number of columns in a line
207 dot_horz_spacing spinh Yc Spacing of dots horizontally
208 in dots per inch
209 dot_vert_spacing spinv Yb Spacing of pins vertically
210 in pins per inch
211 init_tabs it it Tabs initially every # spaces
212 label_height lh lh Number of rows in each label
213 label_width lw lw Number of columns in each label
214 lines lines li Number of lines on a screen or
215 a page
216 lines_of_memory lm lm Lines of memory if > lines;
217 0 means varies
218 max_attributes ma ma Maximum combined video attributes
219 terminal can display
220 magic_cookie_glitch xmc sg Number of blank characters
221 left by smso or rmso
222 max_colors colors Co Maximum number of colors
223 on the screen
224 max_micro_address maddr Yd Maximum value in
225 micro_..._address
226 max_micro_jump mjump Ye Maximum value in parm_..._micro
227 max_pairs pairs pa Maximum number of
228 color-pairs on the screen
229 maximum_windows Wnum MW Maximum number of definable windows
230 micro_char_size mcs Yf Character step size when
231 in micro mode
232 micro_line_size mls Yg Line step size when in micro mode
233 no_color_video ncv NC Video attributes that
234 can't be used with colors
235 num_labels nlab Nl Number of labels on screen
236 number_of_pins npins Yh Number of pins in print-head
237 output_res_char orc Yi Horizontal resolution in
238 units per character
239 output_res_line orl Yj Vertical resolution in units per
240 line
241 output_res_horz_inch orhi Yk Horizontal resolution in
242 units per inch
243 output_res_vert_inch orvi Yl Vertical resolution in
244 units per inch
245 padding_baud_rate pb pb Lowest baud rate
246 print_rate cps Ym Print rate in characters per second
247 where padding needed
248 virtual_terminal vt vt Virtual terminal number (system)
249 wide_char_size widcs Yn Character step size when
250 in double wide mode
251 width_status_line wsl ws Number of columns in status line
252
253
254
255 Strings
256 ________________________________________________________________
257 Cap- Termcap
258 Variable name Code Description
259 ________________________________________________________________
260
261 acs_chars acsc ac Graphic charset pairs aAbBcC
262 alt_scancode_esc scesa S8 Alternate escape for
263 scancode emulation
264 (default is for vt100)
265 back_tab cbt bt Back tab
266 bell bel bl Audible signal (bell)
267 bit_image_carriage_return bicr Yv Move to beginning of
268 same row (use tparm)
269 bit_image_newline binel Zz Move to next row of
270 the bit image (use tparm)
271 bit_image_repeat birep Zy Repeat bit-image cell
272 #1 #2 times (use tparm)
273 carriage_return cr cr Carriage return
274 change_char_pitch cpi ZA Change number of
275 characters per inch
276 change_line_pitch lpi ZB Change number of lines per inch
277 change_res_horz chr ZC Change horizontal resolution
278 change_res_vert cvr ZD Change vertical resolution
279 change_scroll_region csr cs Change to lines #1
280 through #2 (vt100)
281 char_padding rmp rP Like ip but when in replace
282 mode
283 char_set_names csnm Zy List of character set names
284 clear_all_tabs tbc ct Clear all tab stops
285 clear_margins mgc MC Clear all margins
286 (top, bottom, and sides)
287 clear_screen clear cl Clear screen and home cursor
288 clr_bol el1 cb Clear to beginning of
289 line, inclusive
290 clr_eol el ce Clear to end of line
291 clr_eos ed cd Clear to end of display
292 code_set_init csin ci Init sequence
293 for multiple codesets
294 color_names colornm Yw Give name for color #1
295 column_address hpa ch Horizontal position
296 command_character cmdch CC Terminal settable cmd
297 character in prototype
298 create_window cwin CW Define win #1 to go
299 from #2,#3to #4,#5
300 cursor_address cup cm Move to row #1 col #2
301 cursor_down cud1 do Down one line
302 cursor_home home ho Home cursor (if no cup)
303 cursor_invisible civis vi Make cursor invisible
304 cursor_left cub1 le Move left one space.
305 cursor_mem_address mrcup CM Memory relative cursor
306 addressing
307 cursor_normal cnorm ve Make cursor appear
308 normal (undo vs/vi)
309 cursor_right cuf1 nd Non-destructive space
310 (cursor or carriage right)
311 cursor_to_ll ll ll Last line, first
312 column (if no cup)
313 cursor_up cuu1 up Upline (cursor up)
314 cursor_visible cvvis vs Make cursor very visible
315 define_bit_image_region defbi Yx Define rectangular bit-
316 image region (use tparm)
317 define_char defc ZE Define a character in
318 a character set
319 delete_character dch1 dc Delete character
320 delete_line dl1 dl Delete line
321 device_type devt dv Indicate language/
322 codeset support
323 dial_phone dial DI Dial phone number #1
324 dis_status_line dsl ds Disable status line
325 display_clock dclk DK Display time-of-day clock
326 display_pc_char dispc S1 Display PC character
327 down_half_line hd hd Half-line down (forward
328 1/2 linefeed)
329 ena_acs enacs eA Enable alternate character set
330 end_bit_image_region endbi Yy End a bit-image region
331 (use tparm)
332 enter_alt_charset_mode smacs as Start alternate character set
333 enter_am_mode smam SA Turn on automatic margins
334 enter_blink_mode blink mb Turn on blinking
335 enter_bold_mode bold md Turn on bold (extra
336 bright) mode
337 enter_ca_mode smcup ti String to begin programs
338 that use cup
339 enter_delete_mode smdc dm Delete mode (enter)
340 enter_dim_mode dim mh Turn on half-bright mode
341 enter_doublewide_mode swidm ZF Enable double wide printing
342 enter_draft_quality sdrfq ZG Set draft quality print mode
343 enter_insert_mode smir im Insert mode (enter)
344 enter_italics_mode sitm ZH Enable italics
345 enter_leftward_mode slm ZI Enable leftward carriage
346 motion
347 enter_micro_mode smicm ZJ Enable micro motion
348 capabilities
349 enter_near_letter_quality snlq ZK Set near-letter quality print
350 enter_normal_quality snrmq ZL Set normal quality
351 enter_pc_charset_mode smpch S2 Enter PC character display mode
352 enter_protected_mode prot mp Turn on protected mode
353 enter_reverse_mode rev mr Turn on reverse video mode
354 enter_scancode_mode smsc S4 Enter PC scancode mode
355 enter_scancode_mode smsc S4 Enter PC scancode mode
356 enter_secure_mode invis mk Turn on blank mode
357 (characters invisible)
358 enter_shadow_mode sshm ZM Enable shadow printing
359 enter_standout_mode smso so Begin standout mode
360 enter_subscript_mode ssubm ZN Enable subscript printing
361 enter_superscript_mode ssupm ZO Enable superscript printing
362 enter_underline_mode smul us Start underscore mode
363 enter_upward_mode sum ZP Enable upward carriage motion
364 mode
365 enter_xon_mode smxon SX Turn on xon/xoff handshaking
366 erase_chars ech ec Erase #1 characters
367 exit_alt_charset_mode rmacs ae End alternate character set
368 exit_am_mode rmam RA Turn off automatic margins
369 exit_attribute_mode sgr0 me Turn off all attributes
370 exit_ca_mode rmcup te String to end programs
371 that use cup
372 exit_delete_mode rmdc ed End delete mode
373 exit_doublewide_mode rwidm ZQ Disable double wide printing
374 exit_insert_mode rmir ei End insert mode
375 exit_italics_mode ritm ZR Disable italics
376 exit_leftward_mode rlm ZS Enable rightward (normal)
377 carriage motion
378 exit_micro_mode rmicm ZT Disable micro motion
379 capabilities
380 exit_pc_charset_mode rmpch S3 Disable PC character
381 display mode
382 exit_scancode_mode rmsc S5 Disable PC scancode mode
383 exit_shadow_mode rshm ZU Disable shadow printing
384 exit_standout_mode rmso se End standout mode
385 exit_subscript_mode rsubm ZV Disable subscript printing
386 exit_superscript_mode rsupm ZW Disable superscript printing
387 exit_underline_mode rmul ue End underscore mode
388 exit_upward_mode rum ZX Enable downward (normal)
389 carriage motion
390 exit_xon_mode rmxon RX Turn off xon/xoff handshaking
391 fixed_pause pause PA Pause for 2-3 seconds
392 flash_hook hook fh Flash the switch hook
393 flash_screen flash vb Visible bell (may
394 not move cursor)
395 form_feed ff ff Hardcopy terminal page eject
396 from_status_line fsl fs Return from status line
397 get_mouse getm Gm Curses should get button events
398 goto_window wingo WG Go to window #1
399 hangup hup HU Hang-up phone
400 init_1string is1 i1 Terminal or printer
401 initialization string
402 init_2string is2 is Terminal or printer
403 initialization string
404 init_3string is3 i3 Terminal or printer
405 initialization string
406 init_file if if Name of initialization file
407 init_prog iprog iP Path name of program
408 for initialization
409 initialize_color initc Ic Initialize the
410 definition of color
411 initialize_pair initp Ip Initialize color-pair
412 insert_character ich1 ic Insert character
413 insert_line il1 al Add new blank line
414 insert_padding ip ip Insert pad after
415 character inserted
416
417
418
419 key_Strings
420 The ``key_'' strings are sent by specific keys. The ``key_'' descrip‐
421 tions include the macro, defined in <curses.h>, for the code returned
422 by the curses routine getch when the key is pressed (see
423 curs_getch(3CURSES)).
424
425 ________________________________________________________________
426 Cap- Termcap
427 Variable name Code Description
428 ________________________________________________________________
429
430 key_a1 ka1 K1 KEY_A1, upper left of keypad
431 key_a3 ka3 K3 KEY_A3, upper right of keypad
432 key_b2 kb2 K2 KEY_B2, center of keypad
433 key_backspace kbs kb KEY_BACKSPACE, sent by
434 backspace key
435 key_beg kbeg @1 KEY_BEG, sent by beg(inning) key
436 key_btab kcbt kB KEY_BTAB, sent by back-tab key
437 key_c1 kc1 K4 KEY_C1, lower left of keypad
438 key_c3 kc3 K5 KEY_C3, lower right of keypad
439 key_cancel kcan @2 KEY_CANCEL, sent by cancel key
440 key_catab ktbc ka KEY_CATAB, sent by
441 clear-all-tabs key
442 key_clear kclr kC KEY_CLEAR, sent by
443 clear-screen or erase key
444 key_close kclo @3 KEY_CLOSE, sent by close key
445 key_command kcmd @4 KEY_COMMAND, sent by
446 cmd (command) key
447 key_copy kcpy @5 KEY_COPY, sent by copy key
448 key_create kcrt @6 KEY_CREATE, sent by create key
449 key_ctab kctab kt KEY_CTAB, sent by clear-tab key
450 key_dc kdch1 kD KEY_DC, sent by delete-character
451 key
452 key_dl kdl1 kL KEY_DL, sent by delete-line key
453 key_down kcud1 kd KEY_DOWN, sent by terminal
454 down-arrow key
455 key_eic krmir kM KEY_EIC, sent by rmir or smir in
456 insert mode
457 key_end kend @7 KEY_END, sent by end key
458 key_enter kent @8 KEY_ENTER, sent by enter/send
459 key
460 key_eol kel kE KEY_EOL, sent by
461 clear-to-end-of-line key
462 key_eos ked kS KEY_EOS, sent by
463 clear-to-end-of-screen key
464 key_exit kext @9 KEY_EXIT, sent by exit key
465 key_f0 kf0 k0 KEY_F(0), sent by function key f0
466 key_f1 kf1 k1 KEY_F(1), sent by function key f1
467 key_f2 kf2 k2 KEY_F(2), sent by function key f2
468 key_f3 kf3 k3 KEY_F(3), sent by function key f3
469 key_fB kf4 k4 KEY_F(4), sent by function key fB
470 key_f5 kf5 k5 KEY_F(5), sent by function key f5
471 key_f6 kf6 k6 KEY_F(6), sent by function key f6
472 key_f7 kf7 k7 KEY_F(7), sent by function key f7
473 key_f8 kf8 k8 KEY_F(8), sent by function key f8
474 key_f9 kf9 k9 KEY_F(9), sent by function key f9
475
476 key_f10 kf10 k; KEY_F(10), sent by function key
477 f10
478 key_f11 kf11 F1 KEY_F(11), sent by function key
479 f11
480 key_f12 kf12 F2 KEY_F(12), sent by function key
481 f12
482 key_f13 kf13 F3 KEY_F(13), sent by function key
483 f13
484 key_f14 kf14 F4 KEY_F(14), sent by function key
485 f14
486 key_f15 kf15 F5 KEY_F(15), sent by function key
487 f15
488 key_f16 kf16 F6 KEY_F(16), sent by function key
489 f16
490 key_f17 kf17 F7 KEY_F(17), sent by function key
491 f17
492 key_f18 kf18 F8 KEY_F(18), sent by function key
493 f18
494 key_f19 kf19 F9 KEY_F(19), sent by function key
495 f19
496 key_f20 kf20 FA KEY_F(20), sent by function key
497 f20
498 key_f21 kf21 FB KEY_F(21), sent by function key
499 f21
500 key_f22 kf22 FC KEY_F(22), sent by function key
501 f22
502 key_f23 kf23 FD KEY_F(23), sent by function key
503 f23
504 key_f24 kf24 FE KEY_F(24), sent by function key
505 f24
506 key_f25 kf25 FF KEY_F(25), sent by function key
507 f25
508 key_f26 kf26 FG KEY_F(26), sent by function key
509 f26
510 key_f27 kf27 FH KEY_F(27), sent by function key
511 f27
512 key_f28 kf28 FI KEY_F(28), sent by function key
513 f28
514 key_f29 kf29 FJ KEY_F(29), sent by function key
515 f29
516 key_f30 kf30 FK KEY_F(30), sent by function key
517 f30
518 key_f31 kf31 FL KEY_F(31), sent by function key
519 f31
520 key_f32 kf32 FM KEY_F(32), sent by function key
521 f32
522 key_f33 kf33 FN KEY_F(13), sent by function key
523 f13
524 key_f34 kf34 FO KEY_F(34), sent by function key
525 f34
526 key_f35 kf35 FP KEY_F(35), sent by function key
527 f35
528 key_f36 kf36 FQ KEY_F(36), sent by function key
529 f36
530 key_f37 kf37 FR KEY_F(37), sent by function key
531 f37
532 key_f38 kf38 FS KEY_F(38), sent by function key
533 f38
534 key_f39 kf39 FT KEY_F(39), sent by function key
535 f39
536 key_fB0 kf40 FU KEY_F(40), sent by function key
537 fB0
538 key_fB1 kf41 FV KEY_F(41), sent by function key
539 fB1
540 key_fB2 kf42 FW KEY_F(42), sent by function key
541 fB2
542 key_fB3 kf43 FX KEY_F(43), sent by function key
543 fB3
544 key_fB4 kf44 FY KEY_F(44), sent by function key
545 fB4
546 key_fB5 kf45 FZ KEY_F(45), sent by function key
547 fB5
548 key_fB6 kf46 Fa KEY_F(46), sent by function key
549 fB6
550 key_fB7 kf47 Fb KEY_F(47), sent by function key
551 fB7
552 key_fB8 kf48 Fc KEY_F(48), sent by function key
553 fB8
554 key_fB9 kf49 Fd KEY_F(49), sent by function key
555 fB9
556 key_f50 kf50 Fe KEY_F(50), sent by function key
557 f50
558 key_f51 kf51 Ff KEY_F(51), sent by function key
559 f51
560 key_f52 kf52 Fg KEY_F(52), sent by function key
561 f52
562 key_f53 kf53 Fh KEY_F(53), sent by function key
563 f53
564 key_f54 kf54 Fi KEY_F(54), sent by function key
565 f54
566 key_f55 kf55 Fj KEY_F(55), sent by function key
567 f55
568 key_f56 kf56 Fk KEY_F(56), sent by function key
569 f56
570 key_f57 kf57 Fl KEY_F(57), sent by function key
571 f57
572 key_f58 kf58 Fm KEY_F(58), sent by function key
573 f58
574 key_f59 kf59 Fn KEY_F(59), sent by function key
575 f59
576 key_f60 kf60 Fo KEY_F(60), sent by function key
577 f60
578 key_f61 kf61 Fp KEY_F(61), sent by function key
579 f61
580 key_f62 kf62 Fq KEY_F(62), sent by function key
581 f62
582 key_f63 kf63 Fr KEY_F(63), sent by function key
583 f63
584 key_find kfnd @0 KEY_FIND, sent by find key
585 key_help khlp %1 KEY_HELP, sent by help key
586 key_home khome kh KEY_HOME, sent by home key
587 key_ic kich1 kI KEY_IC, sent by ins-char/enter
588 ins-mode key
589 key_il kil1 kA KEY_IL, sent by insert-line key
590 key_left kcub1 kl KEY_LEFT, sent by
591 terminal left-arrow key
592 key_ll kll kH KEY_LL, sent by home-down key
593 key_mark kmrk %2 KEY_MARK, sent by
594 key_message kmsg %3 KEY_MESSAGE, sent by message key
595 key_mouse kmous Km 0631, Mouse event has occured
596 key_move kmov %4 KEY_MOVE, sent by move key
597 key_next knxt %5 KEY_NEXT, sent by next-object
598 key
599 key_npage knp kN KEY_NPAGE, sent by next-page
600 key
601 key_open kopn %6 KEY_OPEN, sent by open key
602 key_options kopt %7 KEY_OPTIONS, sent by options
603 key
604 key_ppage kpp kP KEY_PPAGE, sent by
605 previous-page key
606 key_previous kprv %8 KEY_PREVIOUS, sent by
607 previous-object key
608 key_print kprt %9 KEY_PRINT, sent by
609 print or copy key
610 key_redo krdo %0 KEY_REDO, sent by redo key
611 key_reference kref &1 KEY_REFERENCE, sent by
612 reference key
613 key_refresh krfr &2 KEY_REFRESH, sent by
614 refresh key
615 key_replace krpl &3 KEY_REPLACE, sent by
616 replace key
617 key_restart krst &4 KEY_RESTART, sent by
618 restart key
619 key_resume kres &5 KEY_RESUME, sent by resume key
620 key_right kcuf1 kr KEY_RIGHT, sent by terminal
621 right-arrow key
622 key_save ksav &6 KEY_SAVE, sent by save key
623 key_sbeg kBEG &9 KEY_SBEG, sent by
624 shifted beginning key
625 key_scancel kCAN &0 KEY_SCANCEL, sent by
626 shifted cancel key
627 key_scommand kCMD *1 KEY_SCOMMAND, sent by
628 shifted command key
629 key_scopy kCPY *2 KEY_SCOPY, sent by
630 shifted copy key
631 key_screate kCRT *3 KEY_SCREATE, sent by
632 shifted create key
633 key_sdc kDC *4 KEY_SDC, sent by
634 shifted delete-char key
635 key_sdl kDL *5 KEY_SDL, sent by
636 shifted delete-line key
637 key_select kslt *6 KEY_SELECT, sent by
638 select key
639 key_send kEND *7 KEY_SEND, sent by
640 shifted end key
641 key_seol kEOL *8 KEY_SEOL, sent by
642 shifted clear-line key
643 key_sexit kEXT *9 KEY_SEXIT, sent by
644 shifted exit key
645 key_sf kind kF KEY_SF, sent by
646 scroll-forward/down key
647 key_sfind kFND *0 KEY_SFIND, sent by
648 shifted find key
649 key_shelp kHLP #1 KEY_SHELP, sent by
650 shifted help key
651 key_shome kHOM #2 KEY_SHOME, sent by
652 shifted home key
653 key_sic kIC #3 KEY_SIC, sent by
654 shifted input key
655 key_sleft kLFT #4 KEY_SLEFT, sent by
656 shifted left-arrow key
657 key_smessage kMSG %a KEY_SMESSAGE, sent by
658 shifted message key
659 key_smove kMOV %b KEY_SMOVE, sent by
660 shifted move key
661 key_snext kNXT %c KEY_SNEXT, sent by
662 shifted next key
663 key_soptions kOPT %d KEY_SOPTIONS, sent by
664 shifted options key
665 key_sprevious kPRV %e KEY_SPREVIOUS, sent by
666 shifted prev key
667 key_sprint kPRT %f KEY_SPRINT, sent by
668 shifted print key
669 key_sr kri kR KEY_SR, sent by
670 scroll-backward/up key
671 key_sredo kRDO %g KEY_SREDO, sent by
672 shifted redo key
673 key_sreplace kRPL %h KEY_SREPLACE, sent by
674 shifted replace key
675 key_sright kRIT %i KEY_SRIGHT, sent by shifted
676 right-arrow key
677 key_srsume kRES %j KEY_SRSUME, sent by
678 shifted resume key
679 key_ssave kSAV !1 KEY_SSAVE, sent by
680 shifted save key
681 key_ssuspend kSPD !2 KEY_SSUSPEND, sent by
682 shifted suspend key
683 key_stab khts kT KEY_STAB, sent by
684 set-tab key
685 key_sundo kUND !3 KEY_SUNDO, sent by
686 shifted undo key
687 key_suspend kspd &7 KEY_SUSPEND, sent by
688 suspend key
689 key_undo kund &8 KEY_UNDO, sent by undo key
690 key_up kcuu1 ku KEY_UP, sent by
691 terminal up-arrow key
692 keypad_local rmkx ke Out of
693 ``keypad-transmit'' mode
694 keypad_xmit smkx ks Put terminal in
695 ``keypad-transmit'' mode
696 lab_f0 lf0 l0 Labels on function key
697 f0 if not f0
698 lab_f1 lf1 l1 Labels on function key
699 f1 if not f1
700 lab_f2 lf2 l2 Labels on function key
701 f2 if not f2
702 lab_f3 lf3 l3 Labels on function key
703 f3 if not f3
704 lab_fB lfB l4 Labels on function key
705 fB if not fB
706 lab_f5 lf5 l5 Labels on function key
707 f5 if not f5
708 lab_f6 lf6 l6 Labels on function key
709 f6 if not f6
710 lab_f7 lf7 l7 Labels on function key
711 f7 if not f7
712 lab_f8 lf8 l8 Labels on function key
713 f8 if not f8
714 lab_f9 lf9 l9 Labels on function key
715 f9 if not f9
716 lab_f10 lf10 la Labels on function key
717 f10 if not f10
718 label_format fln Lf Label format
719 label_off rmln LF Turn off soft labels
720 label_on smln LO Turn on soft labels
721 meta_off rmm mo Turn off "meta mode"
722 meta_on smm mm Turn on "meta mode" (8th bit)
723 micro_column_address mhpa ZY Like column_address
724 for micro adjustment
725 micro_down mcud1 ZZ Like cursor_down
726 for micro adjustment
727 micro_left mcub1 Za Like cursor_left
728 for micro adjustment
729 micro_right mcuf1 Zb Like cursor_right
730 for micro adjustment
731 micro_row_address mvpa Zc Like row_address
732 for micro adjustment
733 micro_up mcuu1 Zd Like cursor_up
734 for micro adjustment
735 mouse_info minfo Mi Mouse status information
736 newline nel nw Newline (behaves like
737 cr followed by lf)
738 order_of_pins porder Ze Matches software bits
739 to print-head pins
740 orig_colors oc oc Set all color(-pair)s
741 to the original ones
742 orig_pair op op Set default color-pair
743 to the original one
744 pad_char pad pc Pad character (rather than null)
745 parm_dch dch DC Delete #1 chars
746 parm_delete_line dl DL Delete #1 lines
747 parm_down_cursor cud DO Move down #1 lines
748 parm_down_micro mcud Zf Like parm_down_cursor
749 for micro adjust
750 parm_ich ich IC Insert #1 blank chars
751 parm_index indn SF Scroll forward #1 lines
752 parm_insert_line il AL Add #1 new blank lines
753 parm_left_cursor cub LE Move cursor left #1 spaces
754 parm_left_micro mcub Zg Like parm_left_cursor
755 for micro adjust
756 parm_right_cursor cuf RI Move right #1 spaces
757 parm_right_micro mcuf Zh Like parm_right_cursor
758 for micro adjust
759 parm_rindex rin SR Scroll backward #1 lines
760 parm_up_cursor cuu UP Move cursor up #1 lines
761 parm_up_micro mcuu Zi Like parm_up_cursor
762 for micro adjust
763 pc_term_options pctrm S6 PC terminal options
764 pkey_key pfkey pk Prog funct key #1 to
765 type string #2
766 pkey_local pfloc pl Prog funct key #1 to
767 execute string #2
768 pkey_plab pfxl xl Prog key #1 to xmit
769 string #2 and show string #3
770 pkey_xmit pfx px Prog funct key #1 to
771 xmit string #2
772 plab_norm pln pn Prog label #1 to show
773 string #2
774 print_screen mc0 ps Print contents of the screen
775 prtr_non mc5p pO Turn on the printer for #1 bytes
776 prtr_off mc4 pf Turn off the printer
777 prtr_on mc5 po Turn on the printer
778 pulse pulse PU Select pulse dialing
779 quick_dial qdial QD Dial phone number #1, without
780 progress detection
781 remove_clock rmclk RC Remove time-of-day clock
782 repeat_char rep rp Repeat char #1 #2 times
783 req_for_input rfi RF Send next input char (for ptys)
784 req_mouse_pos reqmp RQ Request mouse position report
785 reset_1string rs1 r1 Reset terminal completely to
786 sane modes
787 reset_2string rs2 r2 Reset terminal completely to
788 sane modes
789 reset_3string rs3 r3 Reset terminal completely to
790 sane modes
791 reset_file rf rf Name of file containing
792 reset string
793 restore_cursor rc rc Restore cursor to
794 position of last sc
795 row_address vpa cv Vertical position absolute
796 save_cursor sc sc Save cursor position
797 scancode_escape scesc S7 Escape for scancode emulation
798 scroll_forward ind sf Scroll text up
799 scroll_reverse ri sr Scroll text down
800 select_char_set scs Zj Select character set
801 set0_des_seq s0ds s0 Shift into codeset 0
802 (EUC set 0, ASCII)
803 set1_des_seq s1ds s1 Shift into codeset 1
804 set2_des_seq s2ds s2 Shift into codeset 2
805 set3_des_seq s3ds s3 Shift into codeset 3
806 attributes #1-#6
807 set_a_background setab AB Set background color
808 using ANSI escape
809 set_a_foreground setaf AF Set foreground color
810 using ANSI escape
811 set_attributes sgr sa Define the video
812 attributes #1-#9
813 set_background setb Sb Set current background color
814 set_bottom_margin smgb Zk Set bottom margin at
815 current line
816 set_bottom_margin_parm smgbp Zl Set bottom margin at
817 line #1 or #2
818 lines from bottom
819 set_clock sclk SC Set time-of-day clock
820 set_color_band setcolor YzChange to ribbon color #1
821 set_color_pair scp sp Set current color-pair
822 set_foreground setf Sf Set current foreground color1
823 set_left_margin smgl ML Set left margin at current line
824 set_left_margin_parm smglp Zm Set left (right) margin
825 at column #1 (#2)
826 set_lr_margin smglr ML Sets both left and right margins
827 set_page_length slines YZ Set page length to #1 lines
828 (use tparm) of an inch
829 set_right_margin smgr MR Set right margin at
830 current column
831 set_right_margin_parm smgrp Zn Set right margin at column #1
832 set_tab hts st Set a tab in all rows,
833 current column
834 set_tb_margin smgtb MT Sets both top and bottom margins
835 set_top_margin smgt Zo Set top margin at current line
836 set_top_margin_parm smgtp Zp Set top (bottom) margin
837 at line #1 (#2)
838 set_window wind wi Current window is lines
839 #1-#2 cols #3-#4
840 start_bit_image sbim Zq Start printing bit image graphics
841 start_char_set_def scsd Zr Start definition of a character
842 set
843 stop_bit_image rbim Zs End printing bit image graphics
844 stop_char_set_def rcsd Zt End definition of a character set
845 subscript_characters subcs Zu List of ``subscript-able''
846 characters
847 superscript_characters supcs Zv List of ``superscript-able''
848 characters
849 tab ht ta Tab to next 8-space hardware tab
850 stop
851 these_cause_cr docr Zw Printing any of these
852 chars causes cr
853 to_status_line tsl ts Go to status line, col #1
854 tone tone TO Select touch tone dialing
855 user0 u0 u0 User string 0
856 user1 u1 u1 User string 1
857 user2 u2 u2 User string 2
858 user3 u3 u3 User string 3
859 user4 u4 u4 User string 4
860 user5 u5 u5 User string 5
861 user6 u6 u6 User string 6
862 user7 u7 u7 User string 7
863 user8 u8 u8 User string 8
864 user9 u9 u9 User string 9
865 underline_char uc uc Underscore one char
866 and move past it
867 up_half_line hu hu Half-line up (reverse
868 1/2 linefeed)
869 wait_tone wait WA Wait for dial tone
870 xoff_character xoffc XF X-off character
871 xon_character xonc XN X-on character
872 zero_motion zerom Zx No motion for the
873 subsequent character
874
875
876
877 Sample Entry
878 The following entry, which describes the AT&T 610 terminal, is among
879 the more complex entries in the terminfo file as of this writing.
880
881 610|610bct|ATT610|att610|AT&T610;80column;98key keyboard
882 am, eslok, hs, mir, msgr, xenl, xon,
883 cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80,
884 acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
885 bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z,
886 civis=\E[?25l, clear=\E[H\E[J, cnorm=\E[?25h\E[?12l,
887 cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b,
888 cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C,
889 cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
890 cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m,
891 dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K,
892 flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=\t,
893 ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, .ind=\ED$<9>,
894 invis=\E[8m,
895 is1=\E[8;0 | \E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0,
896 is2=\E[0m^O, is3=\E(B\E)0, kLFT=\E[\s@, kRIT=\E[\sA,
897 kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B,
898 kcuf1=\E[C, kcuu1=\E[A, kf1=\EOc, kf10=\ENp,
899 kf11=\ENq, kf12=\ENr, kf13=\ENs, kf14=\ENt, kf2=\EOd,
900 kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi,
901 kf8=\EOj, kf9=\ENo, khome=\E[H, kind=\E[S, kri=\E[T,
902 ll=\E[24H, mc4=\E[?4i, mc5=\E[?5i, nel=\EE,
903 pfxl=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t\s\s\sF%p1%1d\s\s\s\s\s
904 \s\s\s\s\s\s%%p2%s,
905 pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m,
906 ri=\EM, rmacs=^O, rmir=\E[4l, rmln=\E[2p, rmso=\E[m,
907 rmul=\E[m, rs2=\Ec\E[?3l, sc=\E7,
908 sgr=\E[0%?%p6%t;1%%?%p5%t;2%%?%p2%t;4%%?%p4%t;5%
909 %?%p3%p1% | %t;7%%?%p7%t;8%m%?%p9%t^N%e^O%,
910 sgr0=\E[m^O, smacs=^N, smir=\E[4h, smln=\E[p,
911 smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx,
912
913
914 Types of Capabilities in the Sample Entry
915 The sample entry shows the formats for the three types of terminfo
916 capabilities listed: Boolean, numeric, and string. All capabilities
917 specified in the terminfo source file must be followed by commas,
918 including the last capability in the source file. In terminfo source
919 files, capabilities are referenced by their capability names (as shown
920 in the previous tables).
921
922
923 Boolean capabilities are specified simply by their comma separated cap
924 names.
925
926
927 Numeric capabilities are followed by the character `#' and then a posi‐
928 tive integer value. Thus, in the sample, cols (which shows the number
929 of columns available on a device) is assigned the value 80 for the AT&T
930 610. (Values for numeric capabilities may be specified in decimal,
931 octal, or hexadecimal, using normal C programming language conven‐
932 tions.)
933
934
935 Finally, string-valued capabilities such as el (clear to end of line
936 sequence) are listed by a two- to five-character capname, an `=', and a
937 string ended by the next occurrence of a comma. A delay in milliseconds
938 may appear anywhere in such a capability, preceded by $ and enclosed in
939 angle brackets, as in el=\EK$<3>. Padding characters are supplied by
940 tput. The delay can be any of the following: a number, a number fol‐
941 lowed by an asterisk, such as 5*, a number followed by a slash, such as
942 5/, or a number followed by both, such as 5*/. A `*' shows that the
943 padding required is proportional to the number of lines affected by the
944 operation, and the amount given is the per-affected-unit padding
945 required. (In the case of insert characters, the factor is still the
946 number of lines affected. This is always 1 unless the device has in and
947 the software uses it.) When a `*' is specified, it is sometimes useful
948 to give a delay of the form 3.5 to specify a delay per unit to tenths
949 of milliseconds. (Only one decimal place is allowed.)
950
951
952 A `/' indicates that the padding is mandatory. If a device has xon
953 defined, the padding information is advisory and will only be used for
954 cost estimates or when the device is in raw mode. Mandatory padding
955 will be transmitted regardless of the setting of xon. If padding
956 (whether advisory or mandatory) is specified for bel or flash, however,
957 it will always be used, regardless of whether xon is specified.
958
959
960 terminfo offers notation for encoding special characters. Both \E and
961 \e map to an ESCAPE character, ^x maps to a control x for any appropri‐
962 ate x, and the sequences \n, \l, \r, \t, \b, \f, and \s give a newline,
963 linefeed, return, tab, backspace, formfeed, and space, respectively.
964 Other escapes include: \^ for caret (^); \\ for backslash (\); \, for
965 comma (,); \: for colon (:); and \0 for null. (\0 will actually produce
966 \200, which does not terminate a string but behaves as a null character
967 on most devices, providing CS7 is specified. (See stty(1)). Finally,
968 characters may be given as three octal digits after a backslash (for
969 example, \123).
970
971
972 Sometimes individual capabilities must be commented out. To do this,
973 put a period before the capability name. For example, see the second
974 ind in the example above. Note that capabilities are defined in a left-
975 to-right order and, therefore, a prior definition will override a later
976 definition.
977
978 Preparing Descriptions
979 The most effective way to prepare a device description is by imitating
980 the description of a similar device in terminfo and building up a
981 description gradually, using partial descriptions with vi to check that
982 they are correct. Be aware that a very unusual device may expose defi‐
983 ciencies in the ability of the terminfo file to describe it or the
984 inability of vi to work with that device. To test a new device descrip‐
985 tion, set the environment variable TERMINFO to the pathname of a direc‐
986 tory containing the compiled description you are working on and pro‐
987 grams will look there rather than in /usr/share/lib/terminfo. To get
988 the padding for insert-line correct (if the device manufacturer did not
989 document it) a severe test is to comment out xon, edit a large file at
990 9600 baud with vi, delete 16 or so lines from the middle of the screen,
991 and then press the u key several times quickly. If the display is cor‐
992 rupted, more padding is usually needed. A similar test can be used for
993 insert-character.
994
995 Section 1-1: Basic Capabilities
996 The number of columns on each line for the device is given by the cols
997 numeric capability. If the device has a screen, then the number of
998 lines on the screen is given by the lines capability. If the device
999 wraps around to the beginning of the next line when it reaches the
1000 right margin, then it should have the am capability. If the terminal
1001 can clear its screen, leaving the cursor in the home position, then
1002 this is given by the clear string capability. If the terminal over‐
1003 strikes (rather than clearing a position when a character is struck
1004 over) then it should have the os capability. If the device is a print‐
1005 ing terminal, with no soft copy unit, specify both hc and os. If there
1006 is a way to move the cursor to the left edge of the current row, spec‐
1007 ify this as cr. (Normally this will be carriage return, control M.) If
1008 there is a way to produce an audible signal (such as a bell or a beep),
1009 specify it as bel. If, like most devices, the device uses the xon-xoff
1010 flow-control protocol, specify xon.
1011
1012
1013 If there is a way to move the cursor one position to the left (such as
1014 backspace), that capability should be given as cub1. Similarly,
1015 sequences to move to the right, up, and down should be given as cuf1,
1016 cuu1, and cud1, respectively. These local cursor motions must not alter
1017 the text they pass over; for example, you would not normally use
1018 ``cuf1=\s'' because the space would erase the character moved over.
1019
1020
1021 A very important point here is that the local cursor motions encoded in
1022 terminfo are undefined at the left and top edges of a screen terminal.
1023 Programs should never attempt to backspace around the left edge, unless
1024 bw is specified, and should never attempt to go up locally off the top.
1025 To scroll text up, a program goes to the bottom left corner of the
1026 screen and sends the ind (index) string.
1027
1028
1029 To scroll text down, a program goes to the top left corner of the
1030 screen and sends the ri (reverse index) string. The strings ind and ri
1031 are undefined when not on their respective corners of the screen.
1032
1033
1034 Parameterized versions of the scrolling sequences are indn and rin.
1035 These versions have the same semantics as ind and ri, except that they
1036 take one parameter and scroll the number of lines specified by that
1037 parameter. They are also undefined except at the appropriate edge of
1038 the screen.
1039
1040
1041 The am capability tells whether the cursor sticks at the right edge of
1042 the screen when text is output, but this does not necessarily apply to
1043 a cuf1 from the last column. Backward motion from the left edge of the
1044 screen is possible only when bw is specified. In this case, cub1 will
1045 move to the right edge of the previous row. If bw is not given, the
1046 effect is undefined. This is useful for drawing a box around the edge
1047 of the screen, for example. If the device has switch selectable auto‐
1048 matic margins, am should be specified in the terminfo source file. In
1049 this case, initialization strings should turn on this option, if possi‐
1050 ble. If the device has a command that moves to the first column of the
1051 next line, that command can be given as nel (newline). It does not mat‐
1052 ter if the command clears the remainder of the current line, so if the
1053 device has no cr and lf it may still be possible to craft a working nel
1054 out of one or both of them.
1055
1056
1057 These capabilities suffice to describe hardcopy and screen terminals.
1058 Thus the AT&T 5320 hardcopy terminal is described as follows:
1059
1060 5320|att5320|AT&T 5320 hardcopy terminal,
1061 am, hc, os,
1062 cols#132,
1063 bel=^G, cr=\r, cub1=\b, cnd1=\n,
1064 dch1=\E[P, dl1=\E[M,
1065 ind=\n,
1066
1067
1068
1069
1070 while the Lear Siegler ADM−3 is described as
1071
1072 adm3 | lsi adm3,
1073 am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H,
1074 cud1=^J, ind=^J, lines#24,
1075
1076
1077
1078 Section 1-2: Parameterized Strings
1079 Cursor addressing and other strings requiring parameters are described
1080 by a parameterized string capability, with printf-like escapes (%x) in
1081 it. For example, to address the cursor, the cup capability is given,
1082 using two parameters: the row and column to address to. (Rows and col‐
1083 umns are numbered from zero and refer to the physical screen visible to
1084 the user, not to any unseen memory.) If the terminal has memory rela‐
1085 tive cursor addressing, that can be indicated by mrcup.
1086
1087
1088 The parameter mechanism uses a stack and special % codes to manipulate
1089 the stack in the manner of Reverse Polish Notation (postfix). Typically
1090 a sequence will push one of the parameters onto the stack and then
1091 print it in some format. Often more complex operations are necessary.
1092 Operations are in postfix form with the operands in the usual order.
1093 That is, to subtract 5 from the first parameter, one would use
1094 %p1%{5}%−.
1095
1096
1097 The % encodings have the following meanings:
1098
1099 %%
1100
1101 outputs `%'
1102
1103
1104 %[[:]flags][width[.precision]][doxXs]
1105
1106 as in printf, flags are [−+#] and space
1107
1108
1109 %c
1110
1111 print pop gives %c
1112
1113
1114 %p[1-9]
1115
1116 push ith parm
1117
1118
1119 %P[a-z]
1120
1121 set dynamic variable [a-z] to pop
1122
1123
1124 %g[a-z]
1125
1126 get dynamic variable [a-z] and push it
1127
1128
1129 %P[A-Z]
1130
1131 set static variable [a-z] to pop
1132
1133
1134 %g[A-Z]
1135
1136 get static variable [a-z] and push it
1137
1138
1139 %'c'
1140
1141 push char constant c
1142
1143
1144 %{nn}
1145
1146 push decimal constant nn
1147
1148
1149 %l
1150
1151 push strlen(pop)
1152
1153
1154 %+ %− %* %/ %m
1155
1156 arithmetic (%m is mod): push(pop integer2 op pop integer1)
1157
1158
1159 %& %| %^
1160
1161 bit operations: push(pop integer2 op pop integer1)
1162
1163
1164 %= %> %<
1165
1166 logical operations: push(pop integer2 op pop integer1)
1167
1168
1169 %A %O
1170
1171 logical operations: and, or
1172
1173
1174 %! %~
1175
1176 unary operations: push(op pop)
1177
1178
1179 %i
1180
1181 (for ANSI terminals) add 1 to first parm, if one parm present, or
1182 first two parms, if more than one parm present
1183
1184
1185 %? expr %t thenpart %e elsepart %
1186
1187 if-then-else, %e elsepart is optional; else-if's are possible ala
1188 Algol 68: %? c(1) %t b(1) %e c(2) %t b(2) %e c(3) %t b(3) %e c(4)
1189 %t b(4) %e b(5)% c(i) are conditions, b(i) are bodies.
1190
1191
1192
1193 If the ``−'' flag is used with ``%[doxXs]'', then a colon (:) must be
1194 placed between the ``%'' and the ``−'' to differentiate the flag from
1195 the binary ``%−'' operator, for example ``%:−16.16s''.
1196
1197
1198 Consider the Hewlett-Packard 2645, which, to get to row 3 and column
1199 12, needs to be sent \E&a12c03Y padded for 6 milliseconds. Note that
1200 the order of the rows and columns is inverted here, and that the row
1201 and column are zero-padded as two digits. Thus its cup capability is:
1202 cup=\E&a%p2%2.2dc%p1%2.2dY$<6>
1203
1204
1205 The Micro-Term ACT-IV needs the current row and column sent preceded by
1206 a ^T, with the row and column simply encoded in binary,
1207 ``cup=^T%p1%c%p2%c''. Devices that use ``%c'' need to be able to
1208 backspace the cursor (cub1), and to move the cursor up one line on the
1209 screen (cuu1). This is necessary because it is not always safe to
1210 transmit \n, ^D, and \r, as the system may change or discard them. (The
1211 library routines dealing with terminfo set tty modes so that tabs are
1212 never expanded, so \t is safe to send. This turns out to be essential
1213 for the Ann Arbor 4080.)
1214
1215
1216 A final example is the LSI ADM-3a, which uses row and column offset by
1217 a blank character, thus ``cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c''. After
1218 sending ``\E='', this pushes the first parameter, pushes the ASCII
1219 value for a space (32), adds them (pushing the sum on the stack in
1220 place of the two previous values), and outputs that value as a charac‐
1221 ter. Then the same is done for the second parameter. More complex
1222 arithmetic is possible using the stack.
1223
1224 Section 1-3: Cursor Motions
1225 If the terminal has a fast way to home the cursor (to very upper left
1226 corner of screen) then this can be given as home; similarly a fast way
1227 of getting to the lower left-hand corner can be given as ll; this may
1228 involve going up with cuu1 from the home position, but a program should
1229 never do this itself (unless ll does) because it can make no assumption
1230 about the effect of moving up from the home position. Note that the
1231 home position is the same as addressing to (0,0): to the top left cor‐
1232 ner of the screen, not of memory. (Thus, the \EH sequence on Hewlett-
1233 Packard terminals cannot be used for home without losing some of the
1234 other features on the terminal.)
1235
1236
1237 If the device has row or column absolute-cursor addressing, these can
1238 be given as single parameter capabilities hpa (horizontal position
1239 absolute) and vpa (vertical position absolute). Sometimes these are
1240 shorter than the more general two-parameter sequence (as with the
1241 Hewlett-Packard 2645) and can be used in preference to cup. If there
1242 are parameterized local motions (for example, move n spaces to the
1243 right) these can be given as cud, cub, cuf, and cuu with a single
1244 parameter indicating how many spaces to move. These are primarily use‐
1245 ful if the device does not have cup, such as the Tektronix 4025.
1246
1247
1248 If the device needs to be in a special mode when running a program that
1249 uses these capabilities, the codes to enter and exit this mode can be
1250 given as smcup and rmcup. This arises, for example, from terminals,
1251 such as the Concept, with more than one page of memory. If the device
1252 has only memory relative cursor addressing and not screen relative cur‐
1253 sor addressing, a one screen-sized window must be fixed into the device
1254 for cursor addressing to work properly. This is also used for the Tek‐
1255 tronix 4025, where smcup sets the command character to be the one used
1256 by terminfo. If the smcup sequence will not restore the screen after an
1257 rmcup sequence is output (to the state prior to outputting rmcup),
1258 specify nrrmc.
1259
1260 Section 1-4: Area Clears
1261 If the terminal can clear from the current position to the end of the
1262 line, leaving the cursor where it is, this should be given as el. If
1263 the terminal can clear from the beginning of the line to the current
1264 position inclusive, leaving the cursor where it is, this should be
1265 given as el1. If the terminal can clear from the current position to
1266 the end of the display, then this should be given as ed. ed is only
1267 defined from the first column of a line. (Thus, it can be simulated by
1268 a request to delete a large number of lines, if a true ed is not avail‐
1269 able.)
1270
1271 Section 1-5: Insert/Delete Line
1272 If the terminal can open a new blank line before the line where the
1273 cursor is, this should be given as il1; this is done only from the
1274 first position of a line. The cursor must then appear on the newly
1275 blank line. If the terminal can delete the line which the cursor is on,
1276 then this should be given as dl1; this is done only from the first
1277 position on the line to be deleted. Versions of il1 and dl1 which take
1278 a single parameter and insert or delete that many lines can be given as
1279 il and dl.
1280
1281
1282 If the terminal has a settable destructive scrolling region (like the
1283 VT100) the command to set this can be described with the csr capabil‐
1284 ity, which takes two parameters: the top and bottom lines of the
1285 scrolling region. The cursor position is, alas, undefined after using
1286 this command. It is possible to get the effect of insert or delete line
1287 using this command — the sc and rc (save and restore cursor) commands
1288 are also useful. Inserting lines at the top or bottom of the screen can
1289 also be done using ri or ind on many terminals without a true
1290 insert/delete line, and is often faster even on terminals with those
1291 features.
1292
1293
1294 To determine whether a terminal has destructive scrolling regions or
1295 non-destructive scrolling regions, create a scrolling region in the
1296 middle of the screen, place data on the bottom line of the scrolling
1297 region, move the cursor to the top line of the scrolling region, and do
1298 a reverse index (ri) followed by a delete line (dl1) or index (ind). If
1299 the data that was originally on the bottom line of the scrolling region
1300 was restored into the scrolling region by the dl1 or ind, then the ter‐
1301 minal has non-destructive scrolling regions. Otherwise, it has destruc‐
1302 tive scrolling regions. Do not specify csr if the terminal has non-
1303 destructive scrolling regions, unless ind, ri, indn, rin, dl, and dl1
1304 all simulate destructive scrolling.
1305
1306
1307 If the terminal has the ability to define a window as part of memory,
1308 which all commands affect, it should be given as the parameterized
1309 string wind. The four parameters are the starting and ending lines in
1310 memory and the starting and ending columns in memory, in that order.
1311
1312
1313 If the terminal can retain display memory above, then the da capability
1314 should be given; if display memory can be retained below, then db
1315 should be given. These indicate that deleting a line or scrolling a
1316 full screen may bring non-blank lines up from below or that scrolling
1317 back with ri may bring down non-blank lines.
1318
1319 Section 1-6: Insert/Delete Character
1320 There are two basic kinds of intelligent terminals with respect to
1321 insert/delete character operations which can be described using ter‐
1322 minfo. The most common insert/delete character operations affect only
1323 the characters on the current line and shift characters off the end of
1324 the line rigidly. Other terminals, such as the Concept 100 and the
1325 Perkin Elmer Owl, make a distinction between typed and untyped blanks
1326 on the screen, shifting upon an insert or delete only to an untyped
1327 blank on the screen which is either eliminated, or expanded to two
1328 untyped blanks. You can determine the kind of terminal you have by
1329 clearing the screen and then typing text separated by cursor motions.
1330 Type ``abc def'' using local cursor motions (not spaces) between the
1331 abc and the def. Then position the cursor before the abc and put the
1332 terminal in insert mode. If typing characters causes the rest of the
1333 line to shift rigidly and characters to fall off the end, then your
1334 terminal does not distinguish between blanks and untyped positions. If
1335 the abc shifts over to the def which then move together around the end
1336 of the current line and onto the next as you insert, you have the sec‐
1337 ond type of terminal, and should give the capability in, which stands
1338 for ``insert null.'' While these are two logically separate attributes
1339 (one line versus multiline insert mode, and special treatment of
1340 untyped spaces) we have seen no terminals whose insert mode cannot be
1341 described with the single attribute.
1342
1343
1344 terminfo can describe both terminals that have an insert mode and ter‐
1345 minals which send a simple sequence to open a blank position on the
1346 current line. Give as smir the sequence to get into insert mode. Give
1347 as rmir the sequence to leave insert mode. Now give as ich1 any
1348 sequence needed to be sent just before sending the character to be
1349 inserted. Most terminals with a true insert mode will not give ich1;
1350 terminals that send a sequence to open a screen position should give it
1351 here. (If your terminal has both, insert mode is usually preferable to
1352 ich1. Do not give both unless the terminal actually requires both to be
1353 used in combination.) If post-insert padding is needed, give this as a
1354 number of milliseconds padding in ip (a string option). Any other
1355 sequence which may need to be sent after an insert of a single charac‐
1356 ter may also be given in ip. If your terminal needs both to be placed
1357 into an `insert mode' and a special code to precede each inserted char‐
1358 acter, then both smir/rmir and ich1 can be given, and both will be
1359 used. The ich capability, with one parameter, n, will insert n blanks.
1360
1361
1362 If padding is necessary between characters typed while not in insert
1363 mode, give this as a number of milliseconds padding in rmp.
1364
1365
1366 It is occasionally necessary to move around while in insert mode to
1367 delete characters on the same line (for example, if there is a tab
1368 after the insertion position). If your terminal allows motion while in
1369 insert mode you can give the capability mir to speed up inserting in
1370 this case. Omitting mir will affect only speed. Some terminals (notably
1371 Datamedia's) must not have mir because of the way their insert mode
1372 works.
1373
1374
1375 Finally, you can specify dch1 to delete a single character, dch with
1376 one parameter, n, to delete n characters, and delete mode by giving
1377 smdc and rmdc to enter and exit delete mode (any mode the terminal
1378 needs to be placed in for dch1 to work).
1379
1380
1381 A command to erase n characters (equivalent to outputting n blanks
1382 without moving the cursor) can be given as ech with one parameter.
1383
1384 Section 1-7: Highlighting, Underlining, and Visible Bells
1385 Your device may have one or more kinds of display attributes that allow
1386 you to highlight selected characters when they appear on the screen.
1387 The following display modes (shown with the names by which they are
1388 set) may be available: a blinking screen (blink), bold or extra-bright
1389 characters (bold), dim or half-bright characters (dim), blanking or
1390 invisible text (invis), protected text (prot), a reverse-video screen
1391 (rev), and an alternate character set (smacs to enter this mode and
1392 rmacs to exit it). (If a command is necessary before you can enter
1393 alternate character set mode, give the sequence in enacs or "enable
1394 alternate-character-set" mode.) Turning on any of these modes singly
1395 may or may not turn off other modes.
1396
1397
1398 sgr0 should be used to turn off all video enhancement capabilities. It
1399 should always be specified because it represents the only way to turn
1400 off some capabilities, such as dim or blink.
1401
1402
1403 You should choose one display method as standout mode and use it to
1404 highlight error messages and other kinds of text to which you want to
1405 draw attention. Choose a form of display that provides strong contrast
1406 but that is easy on the eyes. (We recommend reverse-video plus half-
1407 bright or reverse-video alone.) The sequences to enter and exit stand‐
1408 out mode are given as smso and rmso, respectively. If the code to
1409 change into or out of standout mode leaves one or even two blank spaces
1410 on the screen, as the TVI 912 and Teleray 1061 do, then xmc should be
1411 given to tell how many spaces are left.
1412
1413
1414 Sequences to begin underlining and end underlining can be specified as
1415 smul and rmul , respectively. If the device has a sequence to underline
1416 the current character and to move the cursor one space to the right
1417 (such as the Micro-Term MIME), this sequence can be specified as uc.
1418
1419
1420 Terminals with the ``magic cookie'' glitch (xmc) deposit special
1421 ``cookies'' when they receive mode-setting sequences, which affect the
1422 display algorithm rather than having extra bits for each character.
1423 Some terminals, such as the Hewlett-Packard 2621, automatically leave
1424 standout mode when they move to a new line or the cursor is addressed.
1425 Programs using standout mode should exit standout mode before moving
1426 the cursor or sending a newline, unless the msgr capability, asserting
1427 that it is safe to move in standout mode, is present.
1428
1429
1430 If the terminal has a way of flashing the screen to indicate an error
1431 quietly (a bell replacement), then this can be given as flash; it must
1432 not move the cursor. A good flash can be done by changing the screen
1433 into reverse video, pad for 200 ms, then return the screen to normal
1434 video.
1435
1436
1437 If the cursor needs to be made more visible than normal when it is not
1438 on the bottom line (to make, for example, a non-blinking underline into
1439 an easier to find block or blinking underline) give this sequence as
1440 cvvis. The boolean chts should also be given. If there is a way to make
1441 the cursor completely invisible, give that as civis. The capability
1442 cnorm should be given which undoes the effects of either of these
1443 modes.
1444
1445
1446 If your terminal generates underlined characters by using the underline
1447 character (with no special sequences needed) even though it does not
1448 otherwise overstrike characters, then you should specify the capability
1449 ul. For devices on which a character overstriking another leaves both
1450 characters on the screen, specify the capability os. If overstrikes are
1451 erasable with a blank, then this should be indicated by specifying eo.
1452
1453
1454 If there is a sequence to set arbitrary combinations of modes, this
1455 should be given as sgr (set attributes), taking nine parameters. Each
1456 parameter is either 0 or non-zero, as the corresponding attribute is on
1457 or off. The nine parameters are, in order: standout, underline,
1458 reverse, blink, dim, bold, blank, protect, alternate character set. Not
1459 all modes need to be supported by sgr; only those for which correspond‐
1460 ing separate attribute commands exist should be supported. For example,
1461 let's assume that the terminal in question needs the following escape
1462 sequences to turn on various modes.
1463
1464
1465
1466
1467 tparm
1468 parameter attribute escape sequence
1469 ──────────────────────────────────────────────────────────────
1470 none \E[0m
1471 p1 standout \E[0;4;7m
1472 p2 underline \E[0;3m
1473 p3 reverse \E[0;4m
1474 p4 blink \E[0;5m
1475 p5 dim \E[0;7m
1476 p6 bold \E[0;3;4m
1477 p7 invis \E[0;8m
1478 p8 protect not available
1479 p9 altcharset ^O (off) ^N (on)
1480
1481
1482
1483 Note that each escape sequence requires a 0 to turn off other modes
1484 before turning on its own mode. Also note that, as suggested above,
1485 standout is set up to be the combination of reverse and dim. Also,
1486 because this terminal has no bold mode, bold is set up as the combina‐
1487 tion of reverse and underline. In addition, to allow combinations, such
1488 as underline+blink, the sequence to use would be \E[0;3;5m. The termi‐
1489 nal doesn't have protect mode, either, but that cannot be simulated in
1490 any way, so p8 is ignored. The altcharset mode is different in that it
1491 is either ^O or ^N, depending on whether it is off or on. If all modes
1492 were to be turned on, the sequence would be \E[0;3;4;5;7;8m^N.
1493
1494
1495 Now look at when different sequences are output. For example, ;3 is
1496 output when either p2 or p6 is true, that is, if either underline or
1497 bold modes are turned on. Writing out the above sequences, along with
1498 their dependencies, gives the following:
1499
1500
1501
1502
1503 sequence when to output terminfo translation
1504 ──────────────────────────────────────────────────────────────
1505 \E[0 always \E[0
1506 ;3 if p2 or p6 %?%p2%p6%|%t;3%
1507 ;4 if p1 or p3 or p6 %?%p1%p3%|%p6%|%t;4%
1508 ;5 if p4 %?%p4%t;5%
1509 ;7 if p1 or p5 %?%p1%p5%|%t;7%
1510 ;8 if p7 %?%p7%t;8%
1511 m always m
1512 ^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%
1513
1514
1515
1516 Putting this all together into the sgr sequence gives:
1517
1518
1519 sgr=\E[0%?%p2%p6%|%t;3%%?%p1%p3%|%p6% |%t;4%%?%p5%t;5%%?%p1%p5%
1520 |%t;7%%?%p7%t;8%m%?%p9%t^N%e^O%,
1521
1522
1523 Remember that sgr and sgr0 must always be specified.
1524
1525 Section 1-8: Keypad
1526 If the device has a keypad that transmits sequences when the keys are
1527 pressed, this information can also be specified. Note that it is not
1528 possible to handle devices where the keypad only works in local (this
1529 applies, for example, to the unshifted Hewlett-Packard 2621 keys). If
1530 the keypad can be set to transmit or not transmit, specify these
1531 sequences as smkx and rmkx. Otherwise the keypad is assumed to always
1532 transmit.
1533
1534
1535 The sequences sent by the left arrow, right arrow, up arrow, down
1536 arrow, and home keys can be given as kcub1, kcuf1, kcuu1, kcud1,and
1537 khome, respectively. If there are function keys such as f0, f1, ...,
1538 f63, the sequences they send can be specified as kf0, kf1, ..., kf63.
1539 If the first 11 keys have labels other than the default f0 through f10,
1540 the labels can be given as lf0, lf1, ..., lf10. The codes transmitted
1541 by certain other special keys can be given: kll (home down), kbs
1542 (backspace), ktbc (clear all tabs), kctab (clear the tab stop in this
1543 column), kclr (clear screen or erase key), kdch1 (delete character),
1544 kdl1 (delete line), krmir (exit insert mode), kel (clear to end of
1545 line), ked (clear to end of screen), kich1 (insert character or enter
1546 insert mode), kil1 (insert line), knp (next page), kpp (previous page),
1547 kind (scroll forward/down), kri (scroll backward/up), khts (set a tab
1548 stop in this column). In addition, if the keypad has a 3 by 3 array of
1549 keys including the four arrow keys, the other five keys can be given as
1550 ka1, ka3, kb2, kc1, and kc3. These keys are useful when the effects of
1551 a 3 by 3 directional pad are needed. Further keys are defined above in
1552 the capabilities list.
1553
1554
1555 Strings to program function keys can be specified as pfkey, pfloc, and
1556 pfx. A string to program screen labels should be specified as pln. Each
1557 of these strings takes two parameters: a function key identifier and a
1558 string to program it with. pfkey causes pressing the given key to be
1559 the same as the user typing the given string; pfloc causes the string
1560 to be executed by the terminal in local mode; and pfx causes the string
1561 to be transmitted to the computer. The capabilities nlab, lw and lh
1562 define the number of programmable screen labels and their width and
1563 height. If there are commands to turn the labels on and off, give them
1564 in smln and rmln. smln is normally output after one or more pln
1565 sequences to make sure that the change becomes visible.
1566
1567 Section 1-9: Tabs and Initialization
1568 If the device has hardware tabs, the command to advance to the next tab
1569 stop can be given as ht (usually control I). A ``backtab'' command that
1570 moves leftward to the next tab stop can be given as cbt. By convention,
1571 if tty modes show that tabs are being expanded by the computer rather
1572 than being sent to the device, programs should not use ht or cbt (even
1573 if they are present) because the user may not have the tab stops prop‐
1574 erly set. If the device has hardware tabs that are initially set every
1575 n spaces when the device is powered up, the numeric parameter it is
1576 given, showing the number of spaces the tabs are set to. This is nor‐
1577 mally used by tput init (see tput(1)) to determine whether to set the
1578 mode for hardware tab expansion and whether to set the tab stops. If
1579 the device has tab stops that can be saved in nonvolatile memory, the
1580 terminfo description can assume that they are properly set. If there
1581 are commands to set and clear tab stops, they can be given as tbc
1582 (clear all tab stops) and hts (set a tab stop in the current column of
1583 every row).
1584
1585
1586 Other capabilities include: is1, is2, and is3, initialization strings
1587 for the device; iprog, the path name of a program to be run to initial‐
1588 ize the device; and if, the name of a file containing long initializa‐
1589 tion strings. These strings are expected to set the device into modes
1590 consistent with the rest of the terminfo description. They must be sent
1591 to the device each time the user logs in and be output in the following
1592 order: run the program iprog; output is1; output is2; set the margins
1593 using mgc, smgl and smgr; set the tabs using tbc and hts; print the
1594 file if; and finally output is3. This is usually done using the init
1595 option of tput.
1596
1597
1598 Most initialization is done with is2. Special device modes can be set
1599 up without duplicating strings by putting the common sequences in is2
1600 and special cases in is1 and is3. Sequences that do a reset from a
1601 totally unknown state can be given as rs1, rs2, rf, and rs3, analogous
1602 to is1, is2, is3, and if. (The method using files, if and rf, is used
1603 for a few terminals, from /usr/share/lib/tabset/*; however, the recom‐
1604 mended method is to use the initialization and reset strings.) These
1605 strings are output by tput reset, which is used when the terminal gets
1606 into a wedged state. Commands are normally placed in rs1, rs2, rs3, and
1607 rf only if they produce annoying effects on the screen and are not nec‐
1608 essary when logging in. For example, the command to set a terminal into
1609 80-column mode would normally be part of is2, but on some terminals it
1610 causes an annoying glitch on the screen and is not normally needed
1611 because the terminal is usually already in 80-column mode.
1612
1613
1614 If a more complex sequence is needed to set the tabs than can be
1615 described by using tbc and hts, the sequence can be placed in is2 or
1616 if.
1617
1618
1619 Any margin can be cleared with mgc. (For instructions on how to specify
1620 commands to set and clear margins, see "Margins" below under "PRINTER
1621 CAPABILITIES".)
1622
1623 Section 1-10: Delays
1624 Certain capabilities control padding in the tty driver. These are pri‐
1625 marily needed by hard-copy terminals, and are used by tput init to set
1626 tty modes appropriately. Delays embedded in the capabilities cr, ind,
1627 cub1, ff, and tab can be used to set the appropriate delay bits to be
1628 set in the tty driver. If pb (padding baud rate) is given, these values
1629 can be ignored at baud rates below the value of pb.
1630
1631 Section 1-11: Status Lines
1632 If the terminal has an extra ``status line'' that is not normally used
1633 by software, this fact can be indicated. If the status line is viewed
1634 as an extra line below the bottom line, into which one can cursor
1635 address normally (such as the Heathkit h19's 25th line, or the 24th
1636 line of a VT100 which is set to a 23-line scrolling region), the capa‐
1637 bility hs should be given. Special strings that go to a given column of
1638 the status line and return from the status line can be given as tsl and
1639 fsl. (fsl must leave the cursor position in the same place it was
1640 before tsl. If necessary, the sc and rc strings can be included in tsl
1641 and fsl to get this effect.) The capability tsl takes one parameter,
1642 which is the column number of the status line the cursor is to be moved
1643 to.
1644
1645
1646 If escape sequences and other special commands, such as tab, work while
1647 in the status line, the flag eslok can be given. A string which turns
1648 off the status line (or otherwise erases its contents) should be given
1649 as dsl. If the terminal has commands to save and restore the position
1650 of the cursor, give them as sc and rc. The status line is normally
1651 assumed to be the same width as the rest of the screen, for example,
1652 cols. If the status line is a different width (possibly because the
1653 terminal does not allow an entire line to be loaded) the width, in col‐
1654 umns, can be indicated with the numeric parameter wsl.
1655
1656 Section 1-12: Line Graphics
1657 If the device has a line drawing alternate character set, the mapping
1658 of glyph to character would be given in acsc. The definition of this
1659 string is based on the alternate character set used in the DEC VT100
1660 terminal, extended slightly with some characters from the AT&T 4410v1
1661 terminal.
1662
1663
1664
1665
1666 Glyph Name vt100+ Character
1667 ───────────────────────────────────────────────────────────
1668 arrow pointing right +
1669 arrow pointing left ,
1670 arrow pointing down .
1671 solid square block 0
1672 lantern symbol I
1673 arrow pointing up −
1674 diamond `
1675 checker board (stipple) a
1676 degree symbol f
1677 plus/minus g
1678 board of squares h
1679 lower right corner j
1680 upper right corner k
1681 upper left corner l
1682 lower left corner m
1683 plus n
1684 scan line 1 o
1685 horizontal line q
1686 scan line 9 s
1687 left tee t
1688 right tee u
1689 bottom tee v
1690 top tee w
1691 vertical line x
1692 bullet ~
1693
1694
1695
1696 The best way to describe a new device's line graphics set is to add a
1697 third column to the above table with the characters for the new device
1698 that produce the appropriate glyph when the device is in the alternate
1699 character set mode. For example,
1700
1701
1702
1703
1704 Glyph Name vt100+ Char New tty Char
1705 ──────────────────────────────────────────────────────────────
1706 upper left corner l R
1707 lower left corner m F
1708 upper right corner k T
1709 lower right corner j G
1710 horizontal line q ,
1711 vertical line x .
1712
1713
1714
1715 Now write down the characters left to right, as in ``acsc=lRmFk‐
1716 TjGq\,x.''.
1717
1718
1719 In addition, terminfo allows you to define multiple character sets. See
1720 Section 2-5 for details.
1721
1722 Section 1-13: Color Manipulation
1723 Let us define two methods of color manipulation: the Tektronix method
1724 and the HP method. The Tektronix method uses a set of N predefined col‐
1725 ors (usually 8) from which a user can select "current" foreground and
1726 background colors. Thus a terminal can support up to N colors mixed
1727 into N*N color-pairs to be displayed on the screen at the same time.
1728 When using an HP method the user cannot define the foreground indepen‐
1729 dently of the background, or vice-versa. Instead, the user must define
1730 an entire color-pair at once. Up to M color-pairs, made from 2*M dif‐
1731 ferent colors, can be defined this way. Most existing color terminals
1732 belong to one of these two classes of terminals.
1733
1734
1735 The numeric variables colors and pairs define the number of colors and
1736 color-pairs that can be displayed on the screen at the same time. If a
1737 terminal can change the definition of a color (for example, the Tek‐
1738 tronix 4100 and 4200 series terminals), this should be specified with
1739 ccc (can change color). To change the definition of a color (Tektronix
1740 4200 method), use initc (initialize color). It requires four arguments:
1741 color number (ranging from 0 to colors−1) and three RGB (red, green,
1742 and blue) values or three HLS colors (Hue, Lightness, Saturation).
1743 Ranges of RGB and HLS values are terminal dependent.
1744
1745
1746 Tektronix 4100 series terminals only use HLS color notation. For such
1747 terminals (or dual-mode terminals to be operated in HLS mode) one must
1748 define a boolean variable hls; that would instruct the curses
1749 init_color routine to convert its RGB arguments to HLS before sending
1750 them to the terminal. The last three arguments to the initc string
1751 would then be HLS values.
1752
1753
1754 If a terminal can change the definitions of colors, but uses a color
1755 notation different from RGB and HLS, a mapping to either RGB or HLS
1756 must be developed.
1757
1758
1759 To set current foreground or background to a given color, use setaf
1760 (set ANSI foreground) and setab (set ANSI background). They require one
1761 parameter: the number of the color. To initialize a color-pair (HP
1762 method), use initp (initialize pair). It requires seven parameters:
1763 the number of a color-pair (range=0 to pairs−1), and six RGB values:
1764 three for the foreground followed by three for the background. (Each of
1765 these groups of three should be in the order RGB.) When initc or initp
1766 are used, RGB or HLS arguments should be in the order "red, green,
1767 blue" or "hue, lightness, saturation"), respectively. To make a color-
1768 pair current, use scp (set color-pair). It takes one parameter, the
1769 number of a color-pair.
1770
1771
1772 Some terminals (for example, most color terminal emulators for PCs)
1773 erase areas of the screen with current background color. In such cases,
1774 bce (background color erase) should be defined. The variable op (origi‐
1775 nal pair) contains a sequence for setting the foreground and the back‐
1776 ground colors to what they were at the terminal start-up time. Simi‐
1777 larly, oc (original colors) contains a control sequence for setting all
1778 colors (for the Tektronix method) or color-pairs (for the HP method) to
1779 the values they had at the terminal start-up time.
1780
1781
1782 Some color terminals substitute color for video attributes. Such video
1783 attributes should not be combined with colors. Information about these
1784 video attributes should be packed into the ncv (no color video) vari‐
1785 able. There is a one-to-one correspondence between the nine least sig‐
1786 nificant bits of that variable and the video attributes. The following
1787 table depicts this correspondence.
1788
1789
1790
1791
1792 Attribute Bit Position Decimal Value
1793 ──────────────────────────────────────────────────────────────
1794 A_STANDOUT 0 1
1795 A_UNDERLINE 1 2
1796
1797 A_REVERSE 2 4
1798 A_BLINK 3 8
1799 A_DIM 4 16
1800 A_BOLD 5 32
1801 A_INVIS 6 64
1802 A_PROTECT 7 128
1803 A_ALTCHARSET 8 256
1804
1805
1806
1807 When a particular video attribute should not be used with colors, the
1808 corresponding ncv bit should be set to 1; otherwise it should be set to
1809 zero. To determine the information to pack into the ncv variable, you
1810 must add together the decimal values corresponding to those attributes
1811 that cannot coexist with colors. For example, if the terminal uses col‐
1812 ors to simulate reverse video (bit number 2 and decimal value 4) and
1813 bold (bit number 5 and decimal value 32), the resulting value for ncv
1814 will be 36 (4 + 32).
1815
1816 Section 1-14: Miscellaneous
1817 If the terminal requires other than a null (zero) character as a pad,
1818 then this can be given as pad. Only the first character of the pad
1819 string is used. If the terminal does not have a pad character, specify
1820 npc.
1821
1822
1823 If the terminal can move up or down half a line, this can be indicated
1824 with hu (half-line up) and hd (half-line down). This is primarily use‐
1825 ful for superscripts and subscripts on hardcopy terminals. If a hard‐
1826 copy terminal can eject to the next page (form feed), give this as ff
1827 (usually control L).
1828
1829
1830 If there is a command to repeat a given character a given number of
1831 times (to save time transmitting a large number of identical charac‐
1832 ters) this can be indicated with the parameterized string rep. The
1833 first parameter is the character to be repeated and the second is the
1834 number of times to repeat it. Thus, tparm(repeat_char, 'x', 10) is the
1835 same as xxxxxxxxxx.
1836
1837
1838 If the terminal has a settable command character, such as the Tektronix
1839 4025, this can be indicated with cmdch. A prototype command character
1840 is chosen which is used in all capabilities. This character is given in
1841 the cmdch capability to identify it. The following convention is sup‐
1842 ported on some systems: If the environment variable CC exists, all
1843 occurrences of the prototype character are replaced with the character
1844 in CC.
1845
1846
1847 Terminal descriptions that do not represent a specific kind of known
1848 terminal, such as switch, dialup, patch, and network, should include
1849 the gn (generic) capability so that programs can complain that they do
1850 not know how to talk to the terminal. (This capability does not apply
1851 to virtual terminal descriptions for which the escape sequences are
1852 known.) If the terminal is one of those supported by the system virtual
1853 terminal protocol, the terminal number can be given as vt. A line-turn-
1854 around sequence to be transmitted before doing reads should be speci‐
1855 fied in rfi.
1856
1857
1858 If the device uses xon/xoff handshaking for flow control, give xon.
1859 Padding information should still be included so that routines can make
1860 better decisions about costs, but actual pad characters will not be
1861 transmitted. Sequences to turn on and off xon/xoff handshaking may be
1862 given in smxon and rmxon. If the characters used for handshaking are
1863 not ^S and ^Q, they may be specified with xonc and xoffc.
1864
1865
1866 If the terminal has a ``meta key'' which acts as a shift key, setting
1867 the 8th bit of any character transmitted, this fact can be indicated
1868 with km. Otherwise, software will assume that the 8th bit is parity and
1869 it will usually be cleared. If strings exist to turn this ``meta mode''
1870 on and off, they can be given as smm and rmm.
1871
1872
1873 If the terminal has more lines of memory than will fit on the screen at
1874 once, the number of lines of memory can be indicated with lm. A value
1875 of lm#0 indicates that the number of lines is not fixed, but that there
1876 is still more memory than fits on the screen.
1877
1878
1879 Media copy strings which control an auxiliary printer connected to the
1880 terminal can be given as mc0: print the contents of the screen, mc4:
1881 turn off the printer, and mc5: turn on the printer. When the printer is
1882 on, all text sent to the terminal will be sent to the printer. A varia‐
1883 tion, mc5p, takes one parameter, and leaves the printer on for as many
1884 characters as the value of the parameter, then turns the printer off.
1885 The parameter should not exceed 255. If the text is not displayed on
1886 the terminal screen when the printer is on, specify mc5i (silent
1887 printer). All text, including mc4, is transparently passed to the
1888 printer while an mc5p is in effect.
1889
1890 Section 1-15: Special Cases
1891 The working model used by terminfo fits most terminals reasonably well.
1892 However, some terminals do not completely match that model, requiring
1893 special support by terminfo. These are not meant to be construed as
1894 deficiencies in the terminals; they are just differences between the
1895 working model and the actual hardware. They may be unusual devices or,
1896 for some reason, do not have all the features of the terminfo model
1897 implemented.
1898
1899
1900 Terminals that cannot display tilde (~) characters, such as certain
1901 Hazeltine terminals, should indicate hz.
1902
1903
1904 Terminals that ignore a linefeed immediately after an am wrap, such as
1905 the Concept 100, should indicate xenl. Those terminals whose cursor
1906 remains on the right-most column until another character has been
1907 received, rather than wrapping immediately upon receiving the right-
1908 most character, such as the VT100, should also indicate xenl.
1909
1910
1911 If el is required to get rid of standout (instead of writing normal
1912 text on top of it), xhp should be given.
1913
1914
1915 Those Teleray terminals whose tabs turn all characters moved over to
1916 blanks, should indicate xt (destructive tabs). This capability is also
1917 taken to mean that it is not possible to position the cursor on top of
1918 a ``magic cookie.'' Therefore, to erase standout mode, it is necessary,
1919 instead, to use delete and insert line.
1920
1921
1922 Those Beehive Superbee terminals which do not transmit the escape or
1923 control−C characters, should specify xsb, indicating that the f1 key is
1924 to be used for escape and the f2 key for control C.
1925
1926 Section 1-16: Similar Terminals
1927 If there are two very similar terminals, one can be defined as being
1928 just like the other with certain exceptions. The string capability use
1929 can be given with the name of the similar terminal. The capabilities
1930 given before use override those in the terminal type invoked by use. A
1931 capability can be canceled by placing xx@ to the left of the capability
1932 definition, where xx is the capability. For example, the entry
1933
1934 att4424-2|Teletype4424 in display function group ii,
1935 rev@, sgr@, smul@, use=att4424,
1936
1937
1938
1939
1940 defines an AT&T4424 terminal that does not have the rev, sgr, and smul
1941 capabilities, and hence cannot do highlighting. This is useful for dif‐
1942 ferent modes for a terminal, or for different user preferences. More
1943 than one use capability may be given.
1944
1945 PART 2: PRINTER CAPABILITIES
1946 The terminfo database allows you to define capabilities of printers as
1947 well as terminals. To find out what capabilities are available for
1948 printers as well as for terminals, see the two lists under "DEVICE
1949 CAPABILITIES" that list capabilities by variable and by capability
1950 name.
1951
1952 Section 2-1: Rounding Values
1953 Because parameterized string capabilities work only with integer val‐
1954 ues, we recommend that terminfo designers create strings that expect
1955 numeric values that have been rounded. Application designers should
1956 note this and should always round values to the nearest integer before
1957 using them with a parameterized string capability.
1958
1959 Section 2-2: Printer Resolution
1960 A printer's resolution is defined to be the smallest spacing of charac‐
1961 ters it can achieve. In general printers have independent resolution
1962 horizontally and vertically. Thus the vertical resolution of a printer
1963 can be determined by measuring the smallest achievable distance between
1964 consecutive printing baselines, while the horizontal resolution can be
1965 determined by measuring the smallest achievable distance between the
1966 left-most edges of consecutive printed, identical, characters.
1967
1968
1969 All printers are assumed to be capable of printing with a uniform hori‐
1970 zontal and vertical resolution. The view of printing that terminfo cur‐
1971 rently presents is one of printing inside a uniform matrix: All charac‐
1972 ters are printed at fixed positions relative to each ``cell'' in the
1973 matrix; furthermore, each cell has the same size given by the smallest
1974 horizontal and vertical step sizes dictated by the resolution. (The
1975 cell size can be changed as will be seen later.)
1976
1977
1978 Many printers are capable of ``proportional printing,'' where the hori‐
1979 zontal spacing depends on the size of the character last printed. ter‐
1980 minfo does not make use of this capability, although it does provide
1981 enough capability definitions to allow an application to simulate pro‐
1982 portional printing.
1983
1984
1985 A printer must not only be able to print characters as close together
1986 as the horizontal and vertical resolutions suggest, but also of ``mov‐
1987 ing'' to a position an integral multiple of the smallest distance away
1988 from a previous position. Thus printed characters can be spaced apart a
1989 distance that is an integral multiple of the smallest distance, up to
1990 the length or width of a single page.
1991
1992
1993 Some printers can have different resolutions depending on different
1994 ``modes.'' In ``normal mode,'' the existing terminfo capabilities are
1995 assumed to work on columns and lines, just like a video terminal. Thus
1996 the old lines capability would give the length of a page in lines, and
1997 the cols capability would give the width of a page in columns. In
1998 ``micro mode,'' many terminfo capabilities work on increments of lines
1999 and columns. With some printers the micro mode may be concomitant with
2000 normal mode, so that all the capabilities work at the same time.
2001
2002 Section 2-3: Specifying Printer Resolution
2003 The printing resolution of a printer is given in several ways. Each
2004 specifies the resolution as the number of smallest steps per distance:
2005
2006 Specification of Printer Resolution
2007 Characteristic Number of Smallest Steps
2008
2009 orhi Steps per inch horizontally
2010 orvi Steps per inch vertically
2011 orc Steps per column
2012 orl Steps per line
2013
2014
2015
2016
2017 When printing in normal mode, each character printed causes movement to
2018 the next column, except in special cases described later; the distance
2019 moved is the same as the per-column resolution. Some printers cause an
2020 automatic movement to the next line when a character is printed in the
2021 rightmost position; the distance moved vertically is the same as the
2022 per-line resolution. When printing in micro mode, these distances can
2023 be different, and may be zero for some printers.
2024
2025 Specification of Printer Resolution
2026 Automatic Motion after Printing
2027
2028 Normal Mode:
2029
2030 orc Steps moved horizontally
2031 orl Steps moved vertically
2032
2033 Micro Mode:
2034
2035 mcs Steps moved horizontally
2036 mls Steps moved vertically
2037
2038
2039
2040
2041 Some printers are capable of printing wide characters. The distance
2042 moved when a wide character is printed in normal mode may be different
2043 from when a regular width character is printed. The distance moved when
2044 a wide character is printed in micro mode may also be different from
2045 when a regular character is printed in micro mode, but the differences
2046 are assumed to be related: If the distance moved for a regular charac‐
2047 ter is the same whether in normal mode or micro mode (mcs=orc), then
2048 the distance moved for a wide character is also the same whether in
2049 normal mode or micro mode. This doesn't mean the normal character dis‐
2050 tance is necessarily the same as the wide character distance, just that
2051 the distances don't change with a change in normal to micro mode. How‐
2052 ever, if the distance moved for a regular character is different in
2053 micro mode from the distance moved in normal mode (mcs<orc), the micro
2054 mode distance is assumed to be the same for a wide character printed in
2055 micro mode, as the table below shows.
2056
2057 Specification of Printer Resolution
2058 Automatic Motion after Printing Wide Character
2059
2060 Normal Mode or Micro Mode (mcs = orc):
2061 sp
2062 widcs Steps moved horizontally
2063
2064 Micro Mode (mcs < orc):
2065
2066 mcs Steps moved horizontally
2067
2068
2069
2070
2071 There may be control sequences to change the number of columns per inch
2072 (the character pitch) and to change the number of lines per inch (the
2073 line pitch). If these are used, the resolution of the printer changes,
2074 but the type of change depends on the printer:
2075
2076 Specification of Printer Resolution
2077 Changing the Character/Line Pitches
2078
2079 cpi Change character pitch
2080 cpix If set, cpi changes orhi, otherwise changes
2081 orc
2082 lpi Change line pitch
2083 lpix If set, lpi changes orvi, otherwise changes
2084 orl
2085 chr Change steps per column
2086 cvr Change steps per line
2087
2088
2089
2090
2091 The cpi and lpi string capabilities are each used with a single argu‐
2092 ment, the pitch in columns (or characters) and lines per inch, respec‐
2093 tively. The chr and cvr string capabilities are each used with a single
2094 argument, the number of steps per column and line, respectively.
2095
2096
2097 Using any of the control sequences in these strings will imply a change
2098 in some of the values of orc, orhi, orl, and orvi. Also, the distance
2099 moved when a wide character is printed, widcs, changes in relation to
2100 orc. The distance moved when a character is printed in micro mode, mcs,
2101 changes similarly, with one exception: if the distance is 0 or 1, then
2102 no change is assumed (see items marked with * in the following table).
2103
2104
2105 Programs that use cpi, lpi, chr, or cvr should recalculate the printer
2106 resolution (and should recalculate other values— see "Effect of Chang‐
2107 ing Printing Resolution" under "Dot-Mapped Graphics").
2108
2109 Specification of Printer Resolution
2110 Effects of Changing the Character/Line Pitches
2111
2112 Before After
2113
2114 Using cpi with cpix clear:
2115 $bold orhi '$ orhi
2116 $bold orc '$ $bold orc = bold orhi over V sub italic cpi$
2117
2118 Using cpi with cpix set:
2119 $bold orhi '$ $bold orhi = bold orc cdot V sub italic cpi$
2120 $bold orc '$ $bold orc$
2121
2122 Using lpi with lpix clear:
2123 $bold orvi '$ $bold orvi$
2124 $bold orl '$ $bold orl = bold orvi over V sub italic lpi$
2125
2126 Using lpi with lpix set:
2127 $bold orvi '$ $bold orvi = bold orl cdot V sub italic lpi$
2128 $bold orl '$ $bold orl$
2129
2130 Using chr:
2131 $bold orhi '$ $bold orhi$
2132 $bold orc '$ $V sub italic chr$
2133
2134 Using cvr:
2135 $bold orvi '$ $bold orvi$
2136 $bold orl '$ $V sub italic cvr$
2137
2138 Using cpi or chr:
2139 $bold widcs '$ $bold widcs = bold {widcs '} bold orc over { bold {orc '} }$
2140 $bold mcs '$ $bold mcs = bold {mcs '} bold orc over { bold {orc '} }$
2141
2142
2143
2144
2145 $V sub italic cpi$, $V sub italic lpi$, $V sub italic chr$, and $V sub
2146 italic cvr$ are the arguments used with cpi, lpi, chr, and cvr, respec‐
2147 tively. The prime marks (') indicate the old values.
2148
2149 Section 2-4: Capabilities that Cause Movement
2150 In the following descriptions, ``movement'' refers to the motion of the
2151 ``current position.'' With video terminals this would be the cursor;
2152 with some printers this is the carriage position. Other printers have
2153 different equivalents. In general, the current position is where a
2154 character would be displayed if printed.
2155
2156
2157 terminfo has string capabilities for control sequences that cause move‐
2158 ment a number of full columns or lines. It also has equivalent string
2159 capabilities for control sequences that cause movement a number of
2160 smallest steps.
2161
2162 String Capabilities for Motion
2163
2164 mcub1 Move 1 step left
2165 mcuf1 Move 1 step right
2166 mcuu1 Move 1 step up
2167 mcud1 Move 1 step down
2168 mcub Move N steps left
2169 mcuf Move N steps right
2170 mcuu Move N steps up
2171 mcud Move N steps down
2172 mhpa Move N steps from the left
2173 mvpa Move N steps from the top
2174
2175
2176
2177
2178 The latter six strings are each used with a single argument, N.
2179
2180
2181 Sometimes the motion is limited to less than the width or length of a
2182 page. Also, some printers don't accept absolute motion to the left of
2183 the current position. terminfo has capabilities for specifying these
2184 limits.
2185
2186 Limits to Motion
2187
2188 mjump Limit on use of mcub1, mcuf1, mcuu1, mcud1
2189 maddr Limit on use of mhpa, mvpa
2190 xhpa If set, hpa and mhpa can't move left
2191 xvpa If set, vpa and mvpa can't move up
2192
2193
2194
2195
2196 If a printer needs to be in a ``micro mode'' for the motion capabili‐
2197 ties described above to work, there are string capabilities defined to
2198 contain the control sequence to enter and exit this mode. A boolean is
2199 available for those printers where using a carriage return causes an
2200 automatic return to normal mode.
2201
2202 Entering/Exiting Micro Mode
2203
2204 smicm Enter micro mode
2205 rmicm Exit micro mode
2206 crxm Using cr exits micro mode
2207
2208
2209
2210
2211 The movement made when a character is printed in the rightmost position
2212 varies among printers. Some make no movement, some move to the begin‐
2213 ning of the next line, others move to the beginning of the same line.
2214 terminfohas boolean capabilities for describing all three cases.
2215
2216 What Happens After Character
2217 Printed in Rightmost Position
2218
2219 sam Automatic move to beginning of same line
2220
2221
2222
2223
2224 Some printers can be put in a mode where the normal direction of motion
2225 is reversed. This mode can be especially useful when there are no capa‐
2226 bilities for leftward or upward motion, because those capabilities can
2227 be built from the motion reversal capability and the rightward or down‐
2228 ward motion capabilities. It is best to leave it up to an application
2229 to build the leftward or upward capabilities, though, and not enter
2230 them in the terminfo database. This allows several reverse motions to
2231 be strung together without intervening wasted steps that leave and
2232 reenter reverse mode.
2233
2234 Entering/Exiting Reverse Modes
2235
2236 slm Reverse sense of horizontal motions
2237 rlm Restore sense of horizontal motions
2238 sum Reverse sense of vertical motions
2239 rum Restore sense of vertical motions
2240
2241 While sense of horizontal motions reversed:
2242 mcub1 Move 1 step right
2243 mcuf1 Move 1 step left
2244 mcub Move N steps right
2245 mcuf Move N steps left
2246 cub1 Move 1 column right
2247 cuf1 Move 1 column left
2248 cub Move N columns right
2249 cuf Move N columns left
2250
2251 While sense of vertical motions reversed:
2252 mcuu1 Move 1 step down
2253 mcud1 Move 1 step up
2254 mcuu Move N steps down
2255 mcud Move N steps up
2256 cuu1 Move 1 line down
2257 cud1 Move 1 line up
2258 cuu Move N lines down
2259 cud Move N lines up
2260
2261
2262
2263
2264 The reverse motion modes should not affect the mvpa and mhpa absolute
2265 motion capabilities. The reverse vertical motion mode should, however,
2266 also reverse the action of the line ``wrapping'' that occurs when a
2267 character is printed in the right-most position. Thus printers that
2268 have the standard terminfo capability am defined should experience
2269 motion to the beginning of the previous line when a character is
2270 printed in the right-most position under reverse vertical motion mode.
2271
2272
2273 The action when any other motion capabilities are used in reverse
2274 motion modes is not defined; thus, programs must exit reverse motion
2275 modes before using other motion capabilities.
2276
2277
2278 Two miscellaneous capabilities complete the list of new motion capabil‐
2279 ities. One of these is needed for printers that move the current posi‐
2280 tion to the beginning of a line when certain control characters, such
2281 as ``line-feed'' or ``form-feed,'' are used. The other is used for the
2282 capability of suspending the motion that normally occurs after printing
2283 a character.
2284
2285 Miscellaneous Motion Strings
2286
2287 docr List of control characters causing cr
2288 zerom Prevent auto motion after printing next single character
2289
2290
2291
2292 Margins
2293 terminfo provides two strings for setting margins on terminals: one
2294 for the left and one for the right margin. Printers, however, have two
2295 additional margins, for the top and bottom margins of each page. Fur‐
2296 thermore, some printers require not using motion strings to move the
2297 current position to a margin and then fixing the margin there, but
2298 require the specification of where a margin should be regardless of the
2299 current position. Therefore terminfo offers six additional strings for
2300 defining margins with printers.
2301
2302 Setting Margins
2303
2304 smgl Set left margin at current column
2305 smgr Set right margin at current column
2306 smgb Set bottom margin at current line
2307 smgt Set top margin at current line
2308 smgbp Set bottom margin at line N
2309 smglp Set left margin at column N
2310 smgrp Set right margin at column N
2311 smgtp Set top margin at line N
2312
2313
2314
2315
2316 The last four strings are used with one or more arguments that give the
2317 position of the margin or margins to set. If both of smglp and smgrp
2318 are set, each is used with a single argument, N, that gives the column
2319 number of the left and right margin, respectively. If both of smgtp and
2320 smgbp are set, each is used to set the top and bottom margin, respec‐
2321 tively: smgtp is used with a single argument, N, the line number of the
2322 top margin; however, smgbp is used with two arguments, N and M, that
2323 give the line number of the bottom margin, the first counting from the
2324 top of the page and the second counting from the bottom. This accommo‐
2325 dates the two styles of specifying the bottom margin in different manu‐
2326 facturers' printers. When coding a terminfo entry for a printer that
2327 has a settable bottom margin, only the first or second parameter should
2328 be used, depending on the printer. When writing an application that
2329 uses smgbp to set the bottom margin, both arguments must be given.
2330
2331
2332 If only one of smglp and smgrp is set, then it is used with two argu‐
2333 ments, the column number of the left and right margins, in that order.
2334 Likewise, if only one of smgtp and smgbp is set, then it is used with
2335 two arguments that give the top and bottom margins, in that order,
2336 counting from the top of the page. Thus when coding a terminfo entry
2337 for a printer that requires setting both left and right or top and bot‐
2338 tom margins simultaneously, only one of smglp and smgrp or smgtp and
2339 smgbp should be defined; the other should be left blank. When writing
2340 an application that uses these string capabilities, the pairs should be
2341 first checked to see if each in the pair is set or only one is set, and
2342 should then be used accordingly.
2343
2344
2345 In counting lines or columns, line zero is the top line and column zero
2346 is the left-most column. A zero value for the second argument with
2347 smgbp means the bottom line of the page.
2348
2349
2350 All margins can be cleared with mgc.
2351
2352 Shadows, Italics, Wide Characters
2353 Five new sets of strings describe the capabilities printers have of
2354 enhancing printed text.
2355
2356 Enhanced Printing
2357
2358 sshm Enter shadow-printing mode
2359 rshm Exit shadow-printing mode
2360 sitm Enter italicizing mode
2361 ritm Exit italicizing mode
2362 swidm Enter wide character mode
2363 rwidm Exit wide character mode
2364 ssupm Enter superscript mode
2365 rsupd
2366 m Exit superscript mode
2367 supcs List of characters available as superscripts
2368 ssubm Enter subscript mode
2369 rsubm Exit subscript mode
2370 subcs List of characters available as subscripts
2371
2372
2373
2374
2375 If a printer requires the sshm control sequence before every character
2376 to be shadow-printed, the rshm string is left blank. Thus programs that
2377 find a control sequence in sshm but none in rshm should use the sshm
2378 control sequence before every character to be shadow-printed; other‐
2379 wise, the sshm control sequence should be used once before the set of
2380 characters to be shadow-printed, followed by rshm. The same is also
2381 true of each of the sitm/ritm, swidm/rwidm, ssupm/rsupm, and ssubm/
2382 rsubm pairs.
2383
2384
2385 Note that terminfo also has a capability for printing emboldened text
2386 (bold). While shadow printing and emboldened printing are similar in
2387 that they ``darken'' the text, many printers produce these two types of
2388 print in slightly different ways. Generally, emboldened printing is
2389 done by overstriking the same character one or more times. Shadow
2390 printing likewise usually involves overstriking, but with a slight
2391 movement up and/or to the side so that the character is ``fatter.''
2392
2393
2394 It is assumed that enhanced printing modes are independent modes, so
2395 that it would be possible, for instance, to shadow print italicized
2396 subscripts.
2397
2398
2399 As mentioned earlier, the amount of motion automatically made after
2400 printing a wide character should be given in widcs.
2401
2402
2403 If only a subset of the printable ASCII characters can be printed as
2404 superscripts or subscripts, they should be listed in supcs or subcs
2405 strings, respectively. If the ssupm or ssubm strings contain control
2406 sequences, but the corresponding supcs or subcs strings are empty, it
2407 is assumed that all printable ASCII characters are available as super‐
2408 scripts or subscripts.
2409
2410
2411 Automatic motion made after printing a superscript or subscript is
2412 assumed to be the same as for regular characters. Thus, for example,
2413 printing any of the following three examples will result in equivalent
2414 motion:
2415
2416
2417 Bi B(i) B^i
2418
2419
2420 Note that the existing msgr boolean capability describes whether motion
2421 control sequences can be used while in ``standout mode.'' This capabil‐
2422 ity is extended to cover the enhanced printing modes added here. msgr
2423 should be set for those printers that accept any motion control
2424 sequences without affecting shadow, italicized, widened, superscript,
2425 or subscript printing. Conversely, if msgr is not set, a program should
2426 end these modes before attempting any motion.
2427
2428 Section 2-5: Alternate Character Sets
2429 In addition to allowing you to define line graphics (described in Sec‐
2430 tion 1-12), terminfo lets you define alternate character sets. The fol‐
2431 lowing capabilities cover printers and terminals with multiple
2432 selectable or definable character sets.
2433
2434 Alternate Character Sets
2435
2436 scs Select character set N
2437 scsd Start definition of character set N, M characters
2438 defc Define character A, B dots wide, descender D
2439 rcsd End definition of character set N
2440 csnm List of character set names
2441 daisy Printer has manually changed print-wheels
2442
2443
2444
2445
2446 The scs, rcsd, and csnm strings are used with a single argument, N, a
2447 number from 0 to 63 that identifies the character set. The scsd string
2448 is also used with the argument N and another, M, that gives the number
2449 of characters in the set. The defc string is used with three arguments:
2450 A gives the ASCII code representation for the character, B gives the
2451 width of the character in dots, and D is zero or one depending on
2452 whether the character is a ``descender'' or not. The defc string is
2453 also followed by a string of ``image-data'' bytes that describe how the
2454 character looks (see below).
2455
2456
2457 Character set 0 is the default character set present after the printer
2458 has been initialized. Not every printer has 64 character sets, of
2459 course; using scs with an argument that doesn't select an available
2460 character set should cause a null result from tparm.
2461
2462
2463 If a character set has to be defined before it can be used, the scsd
2464 control sequence is to be used before defining the character set, and
2465 the rcsd is to be used after. They should also cause a null result from
2466 tparm when used with an argument N that doesn't apply. If a character
2467 set still has to be selected after being defined, the scs control
2468 sequence should follow the rcsd control sequence. By examining the
2469 results of using each of the scs, scsd, and rcsd strings with a charac‐
2470 ter set number in a call to tparm, a program can determine which of the
2471 three are needed.
2472
2473
2474 Between use of the scsd and rcsd strings, the defc string should be
2475 used to define each character. To print any character on printers cov‐
2476 ered by terminfo, the ASCII code is sent to the printer. This is true
2477 for characters in an alternate set as well as ``normal'' characters.
2478 Thus the definition of a character includes the ASCII code that repre‐
2479 sents it. In addition, the width of the character in dots is given,
2480 along with an indication of whether the character should descend below
2481 the print line (such as the lower case letter ``g'' in most character
2482 sets). The width of the character in dots also indicates the number of
2483 image-data bytes that will follow the defc string. These image-data
2484 bytes indicate where in a dot-matrix pattern ink should be applied to
2485 ``draw'' the character; the number of these bytes and their form are
2486 defined below under ``Dot-Mapped Graphics.''
2487
2488
2489 It's easiest for the creator of terminfo entries to refer to each char‐
2490 acter set by number; however, these numbers will be meaningless to the
2491 application developer. The csnm string alleviates this problem by pro‐
2492 viding names for each number.
2493
2494
2495 When used with a character set number in a call to tparm, the csnm
2496 string will produce the equivalent name. These names should be used as
2497 a reference only. No naming convention is implied, although anyone who
2498 creates a terminfo entry for a printer should use names consistent with
2499 the names found in user documents for the printer. Application develop‐
2500 ers should allow a user to specify a character set by number (leaving
2501 it up to the user to examine the csnm string to determine the correct
2502 number), or by name, where the application examines the csnm string to
2503 determine the corresponding character set number.
2504
2505
2506 These capabilities are likely to be used only with dot-matrix printers.
2507 If they are not available, the strings should not be defined. For
2508 printers that have manually changed print-wheels or font cartridges,
2509 the boolean daisy is set.
2510
2511 Section 2-6: Dot-Matrix Graphics
2512 Dot-matrix printers typically have the capability of reproducing
2513 ``raster-graphics'' images. Three new numeric capabilities and three
2514 new string capabilities can help a program draw raster-graphics images
2515 independent of the type of dot-matrix printer or the number of pins or
2516 dots the printer can handle at one time.
2517
2518 Dot-Matrix Graphics
2519
2520 npins Number of pins, N, in print-head
2521 spinv Spacing of pins vertically in pins per inch
2522 spinh Spacing of dots horizontally in dots per inch
2523 porder Matches software bits to print-head pins
2524 sbim Start printing bit image graphics, B bits wide
2525 rbim End printing bit image graphics
2526
2527
2528
2529
2530 The sbim sring is used with a single argument, B, the width of the
2531 image in dots.
2532
2533
2534 The model of dot-matrix or raster-graphics that terminfo presents is
2535 similar to the technique used for most dot-matrix printers: each pass
2536 of the printer's print-head is assumed to produce a dot-matrix that is
2537 N dots high and B dots wide. This is typically a wide, squat, rectangle
2538 of dots. The height of this rectangle in dots will vary from one
2539 printer to the next; this is given in the npins numeric capability. The
2540 size of the rectangle in fractions of an inch will also vary; it can be
2541 deduced from the spinv and spinh numeric capabilities. With these three
2542 values an application can divide a complete raster-graphics image into
2543 several horizontal strips, perhaps interpolating to account for differ‐
2544 ent dot spacing vertically and horizontally.
2545
2546
2547 The sbim and rbim strings are used to start and end a dot-matrix image,
2548 respectively. The sbim string is used with a single argument that gives
2549 the width of the dot-matrix in dots. A sequence of ``image-data bytes''
2550 are sent to the printer after the sbim string and before the rbim
2551 string. The number of bytes is a integral multiple of the width of the
2552 dot-matrix; the multiple and the form of each byte is determined by the
2553 porder string as described below.
2554
2555
2556 The porder string is a comma separated list of pin numbers optionally
2557 followed by an numerical offset. The offset, if given, is separated
2558 from the list with a semicolon. The position of each pin number in the
2559 list corresponds to a bit in an 8-bit data byte. The pins are numbered
2560 consecutively from 1 to npins, with 1 being the top pin. Note that the
2561 term ``pin'' is used loosely here; ``ink-jet'' dot-matrix printers
2562 don't have pins, but can be considered to have an equivalent method of
2563 applying a single dot of ink to paper. The bit positions in porder are
2564 in groups of 8, with the first position in each group the most signifi‐
2565 cant bit and the last position the least significant bit. An applica‐
2566 tion produces 8-bit bytes in the order of the groups in porder.
2567
2568
2569 An application computes the ``image-data bytes'' from the internal
2570 image, mapping vertical dot positions in each print-head pass into
2571 8-bit bytes, using a 1 bit where ink should be applied and 0 where no
2572 ink should be applied. This can be reversed (0 bit for ink, 1 bit for
2573 no ink) by giving a negative pin number. If a position is skipped in
2574 porder, a 0 bit is used. If a position has a lower case `x' instead of
2575 a pin number, a 1 bit is used in the skipped position. For consistency,
2576 a lower case `o' can be used to represent a 0 filled, skipped bit.
2577 There must be a multiple of 8 bit positions used or skipped in porder;
2578 if not, 0 bits are used to fill the last byte in the least significant
2579 bits. The offset, if given, is added to each data byte; the offset can
2580 be negative.
2581
2582
2583 Some examples may help clarify the use of the porder string. The AT&T
2584 470, AT&T 475 and C.Itoh 8510 printers provide eight pins for graphics.
2585 The pins are identified top to bottom by the 8 bits in a byte, from
2586 least significant to most. The porder strings for these printers would
2587 be 8,7,6,5,4,3,2,1. The AT&T 478 and AT&T 479 printers also provide
2588 eight pins for graphics. However, the pins are identified in the
2589 reverse order. The porder strings for these printers would be
2590 1,2,3,4,5,6,7,8. The AT&T 5310, AT&T 5320, DEC LA100, and DEC LN03
2591 printers provide six pins for graphics. The pins are identified top to
2592 bottom by the decimal values 1, 2, 4, 8, 16 and 32. These correspond to
2593 the low six bits in an 8-bit byte, although the decimal values are fur‐
2594 ther offset by the value 63. The porder string for these printers would
2595 be ,,6,5,4,3,2,1;63, or alternately o,o,6,5,4,3,2,1;63.
2596
2597 Section 2-7: Effect of Changing Printing Resolution
2598 If the control sequences to change the character pitch or the line
2599 pitch are used, the pin or dot spacing may change:
2600
2601 Dot-Matrix Graphics
2602 Changing the Character/Line Pitches
2603
2604 cpi Change character pitch
2605 cpix If set, cpi changes spinh
2606 lpi Change line pitch
2607 lpix If set, lpi changes spinv
2608
2609
2610
2611
2612 Programs that use cpi or lpi should recalculate the dot spacing:
2613
2614 Dot-Matrix Graphics
2615 Effects of Changing the Character/Line Pitches
2616
2617 Before After
2618
2619 Using cpi with cpix clear:
2620 $bold spinh '$ $bold spinh$
2621
2622 Using cpi with cpix set:
2623 $bold spinh '$ $bold spinh = bold spinh ' cdot bold orhi over
2624 { bold {orhi '} }$
2625
2626 Using lpi with lpix clear:
2627 $bold spinv '$ $bold spinv$
2628
2629 Using lpi with lpix set:
2630 $bold spinv '$ $bold spinv = bold {spinv '} cdot bold orhi over
2631 { bold {orhi '}}$
2632
2633 Using chr:
2634 $bold spinh '$ $bold spinh$
2635
2636 Using cvr:
2637 $bold spinv '$ $bold spinv$
2638
2639
2640
2641
2642 orhi' and orhi are the values of the horizontal resolution in steps per
2643 inch, before using cpi and after using cpi, respectively. Likewise,
2644 orvi' and orvi are the values of the vertical resolution in steps per
2645 inch, before using lpi and after using lpi, respectively. Thus, the
2646 changes in the dots per inch for dot-matrix graphics follow the changes
2647 in steps per inch for printer resolution.
2648
2649 Section 2-8: Print Quality
2650 Many dot-matrix printers can alter the dot spacing of printed text to
2651 produce near ``letter quality'' printing or ``draft quality'' printing.
2652 Usually it is important to be able to choose one or the other because
2653 the rate of printing generally falls off as the quality improves. There
2654 are three new strings used to describe these capabilities.
2655
2656 Print Quality
2657
2658 snlq Set near-letter quality print
2659 snrmq Set normal quality print
2660 sdrfq Set draft quality print
2661
2662
2663
2664
2665 The capabilities are listed in decreasing levels of quality. If a
2666 printer doesn't have all three levels, one or two of the strings should
2667 be left blank as appropriate.
2668
2669 Section 2-9: Printing Rate and Buffer Size
2670 Because there is no standard protocol that can be used to keep a pro‐
2671 gram synchronized with a printer, and because modern printers can buf‐
2672 fer data before printing it, a program generally cannot determine at
2673 any time what has been printed. Two new numeric capabilities can help a
2674 program estimate what has been printed.
2675
2676 Print Rate/Buffer Size
2677
2678 cps Nominal print rate in characters per second
2679 bufsz Buffer capacity in characters
2680
2681
2682
2683
2684 cps is the nominal or average rate at which the printer prints charac‐
2685 ters; if this value is not given, the rate should be estimated at one-
2686 tenth the prevailing baud rate. bufsz is the maximum number of subse‐
2687 quent characters buffered before the guaranteed printing of an earlier
2688 character, assuming proper flow control has been used. If this value is
2689 not given it is assumed that the printer does not buffer characters,
2690 but prints them as they are received.
2691
2692
2693 As an example, if a printer has a 1000-character buffer, then sending
2694 the letter ``a'' followed by 1000 additional characters is guaranteed
2695 to cause the letter ``a'' to print. If the same printer prints at the
2696 rate of 100 characters per second, then it should take 10 seconds to
2697 print all the characters in the buffer, less if the buffer is not full.
2698 By keeping track of the characters sent to a printer, and knowing the
2699 print rate and buffer size, a program can synchronize itself with the
2700 printer.
2701
2702
2703 Note that most printer manufacturers advertise the maximum print rate,
2704 not the nominal print rate. A good way to get a value to put in for cps
2705 is to generate a few pages of text, count the number of printable char‐
2706 acters, and then see how long it takes to print the text.
2707
2708
2709 Applications that use these values should recognize the variability in
2710 the print rate. Straight text, in short lines, with no embedded control
2711 sequences will probably print at close to the advertised print rate and
2712 probably faster than the rate in cps. Graphics data with a lot of con‐
2713 trol sequences, or very long lines of text, will print at well below
2714 the advertised rate and below the rate in cps. If the application is
2715 using cps to decide how long it should take a printer to print a block
2716 of text, the application should pad the estimate. If the application is
2717 using cps to decide how much text has already been printed, it should
2718 shrink the estimate. The application will thus err in favor of the
2719 user, who wants, above all, to see all the output in its correct place.
2720
2722 /usr/share/lib/terminfo/?/*
2723
2724 compiled terminal description database
2725
2726
2727 /usr/share/lib/.COREterm/?/*
2728
2729 subset of compiled terminal description database
2730
2731
2732 /usr/share/lib/tabset/*
2733
2734 tab settings for some terminals, in a format appropriate to be out‐
2735 put to the terminal (escape sequences that set margins and tabs)
2736
2737
2739 ls(1), pg(1), stty(1), tput(1), tty(1), vi(1), infocmp(1M), tic(1M),
2740 printf(3C), curses(3CURSES), curses(3XCURSES)
2741
2743 The most effective way to prepare a terminal description is by imitat‐
2744 ing the description of a similar terminal in terminfo and to build up a
2745 description gradually, using partial descriptions with a screen ori‐
2746 ented editor, such as vi, to check that they are correct. To easily
2747 test a new terminal description the environment variable TERMINFO can
2748 be set to the pathname of a directory containing the compiled descrip‐
2749 tion, and programs will look there rather than in /usr/share/lib/ter‐
2750 minfo.
2751
2752
2753
2754SunOS 5.11 9 Jul 1996 terminfo(4)