| www.delorie.com/gnu/docs/bash/termcap_13.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A terminal command string that requires parameters contains special
character sequences starting with `%' to say how to encode the
parameters. These sequences control the actions of tparam and
tgoto.
The parameters values passed to tparam or tgoto are
considered to form a vector. A pointer into this vector determines
the next parameter to be processed. Some of the `%'-sequences
encode one parameter and advance the pointer to the next parameter.
Other `%'-sequences alter the pointer or alter the parameter
values without generating output.
For example, the `cm' string for a standard ANSI terminal is written as `\E[%i%d;%dH'. (`\E' stands for ESC.) `cm' by convention always requires two parameters, the vertical and horizontal goal positions, so this string specifies the encoding of two parameters. Here `%i' increments the two values supplied, and each `%d' encodes one of the values in decimal. If the cursor position values 20,58 are encoded with this string, the result is `\E[21;59H'.
First, here are the `%'-sequences that generate output. Except for `%%', each of them encodes one parameter and advances the pointer to the following parameter.
printf, output the next parameter in decimal.
printf: output the next parameter in
decimal, and always use at least two digits.
printf: output the next parameter in
decimal, and always use at least three digits. Note that `%4'
and so on are not defined.
printf.
The following `%'-sequences specify alteration of the parameters (their values, or their order) rather than encoding a parameter for output. They generate no output; they are used only for their side effects on the parameters. Also, they do not advance the "next parameter" pointer except as explicitly stated. Only `%i', `%r' and `%>' are defined in standard Unix termcap. The others are GNU extensions.
Spaces are used above to separate the operands for clarity; the spaces don't appear in the data base, where this sequence is exactly five characters long.
The character op says what kind of arithmetic operation to perform. It can be any of these characters:
The "other operand" may be another parameter's value or a constant; the character type says which. It can be:
The following `%'-sequences are special purpose hacks to compensate for the weird designs of obscure terminals. They modify the next parameter or the next two parameters but do not generate output and do not use up any parameters. `%m' is a GNU extension; the others are defined in standard Unix termcap.
parm = (parm / 10) * 16 + parm % 10; |
parm -= 2 * (parm % 16); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |