Next Previous Contents

126. SLang_process_keystring

Synopsis

Un-escape a key-sequence

Usage

char *SLang_process_keystring (char *kseq);

Description

The SLang_process_keystring function converts an escaped key sequence to its raw form by converting two-character combinations such as ^A to the single character Ctrl-A (ASCII 1). In addition, if the key sequence contains constructs such as ^(XX), where XX represents a two-character termcap specifier, the termcap escape sequence will be looked up and substituted.

Upon success, SLang_process_keystring returns a raw key-sequence whose first character represents the total length of the key-sequence, including the length specifier itself. It returns NULL upon failure.

Example

Consider the following examples:

     SLang_process_keystring ("^X^C");
     SLang_process_keystring ("^[[A");
The first example will return a pointer to a buffer of three characters whose ASCII values are given by {3,24,3}. Similarly, the second example will return a pointer to the four characters {4,27,91,65}. Finally, the result of
     SLang_process_keystring ("^[^(ku)");
will depend upon the termcap/terminfo capability "ku", which represents the escape sequence associated with the terminal's UP arrow key. For an ANSI terminal whose UP arrow produces "ESC [ A", the result will be 5,27,27,91,65.
Notes

SLang_process_keystring returns a pointer to a static area that will be overwritten on subsequent calls.

See Also

SLang_define_key, SLang_make_keystring


Next Previous Contents