1TERMKEY_STRPKEY(3)         Library Functions Manual         TERMKEY_STRPKEY(3)
2
3
4

NAME

6       termkey_strpkey - parse a string representing a key event
7

SYNOPSIS

9       #include <termkey.h>
10
11       char *termkey_strpkey(TermKey *tk, const char *str,
12                   TermKeyKey *key, TermKeyFormat format);
13
14       Link with -ltermkey.
15

DESCRIPTION

17       termkey_strpkey(3)  parses  a string buffer containing a human-readable
18       representation of a key event. It fills  the  key  structure  from  the
19       results  of  this  parsing, similar to the strptime(3) standard library
20       function.
21
22       The format argument specifies the format expected in the string,  as  a
23       bitmask of the following constants:
24
25       TERMKEY_FORMAT_LONGMOD
26              Expect full modifier names e.g. "Shift-" instead of abbreviating
27              to "S-".
28
29       TERMKEY_FORMAT_CARETCTRL
30              If the only modifier is  TERMKEY_MOD_CTRL  on  a  plain  letter,
31              accept it as "^X" rather than "Ctrl-X".
32
33       TERMKEY_FORMAT_ALTISMETA
34              Expect  the  name  "Meta"  or the letter "M" instead of "Alt" or
35              "A".
36
37       TERMKEY_FORMAT_SPACEMOD
38              Expect spaces instead of hyphens to separate the modifer name(s)
39              from the base key name.
40
41       TERMKEY_FORMAT_LOWERMOD
42              Expect lowercase for the modifier name.
43
44       TERMKEY_FORMAT_LOWERSPACE
45              Expect  lowercase  with  spaces  in  for the key name instead of
46              camelCase (for example "page down" instead of "PageDown").
47
48       Before returning, this function canonicalises the key structure accord‐
49       ing to the rules given for termkey_canonicalise(3).
50
51       The TERMKEY_FORMAT_WRAPBRACKET and TERMKEY_FORMAT_MOUSE_POS options are
52       currently  not  supported  by  termkey_strpkey().  When   returning   a
53       TERMKEY_TYPE_UNICODE key structure, this function will fill in the utf8
54       member.
55

RETURN VALUE

57       After a successful parse, termkey_strpkey() returns a  pointer  to  the
58       first  character  of  the input it did not consume. If the input string
59       contains more characters then this will point at  the  first  character
60       beyond.  If  the entire input string was consumed, then this will point
61       at a null byte. If termkey_strpkey() fails to parse, it  returns  NULL.
62       After  a failed parse, the key structure may contain partial or invalid
63       results. The structure will only be valid if  the  function  returns  a
64       non-NULL result.
65

SEE ALSO

67       termkey_new(3), termkey_strfkey(3), termkey_keycmp(3), termkey(7)
68
69
70
71                                                            TERMKEY_STRPKEY(3)
Impressum