Next: Control Sequence Matching, Previous: Overview, Up: Top [Contents][Index]
ctlseqs provides C preprocessor macros representing control functions, which expand to C string literals.
The control function can be one of the following three types:
The name of a helper macro is the control function name with CTLSEQS_
as prefix. For a control function other than elements from the C0 or C1 set,
the corresponding helper macro is a function-like macro which may or may not
take arguments.
Control sequences listed in the helper macros are primarily excerpted from XTerm’s manual, which may differ across implementations.
As ctlseqs does not currently support 8-bit controls, 2-character 7-bit codes
from the C1 set are used instead of their 1-character 8-bit representation.
For example, CTLSEQS_CSI
expands to "\x1b["
.
The following code snippet is an example usage of helper macros:
printf(CTLSEQS_BEL); printf(CTLSEQS_XTVERSION()); printf(CTLSEQS_CUP("%d", "%d"), 3, 4);
Keep in mind that the standard output stream is line buffered in a terminal.
Either fflush(stdout)
after printing, or disable output buffering with
setvbuf(stdout, NULL, _IONBF, 0)
.