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