diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-04-01 13:49:20 +0100 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-04-01 13:49:20 +0100 |
commit | 88230407feb4656748604e7ced1526bdb8982c22 (patch) | |
tree | 0f128abe7736428ac890abb54a8fa6e2af9c2eb8 /termkey_strpkey.3 | |
parent | dbb13defb7ab00b1f4e801f3daab7dd1a3744ac0 (diff) | |
download | termo-88230407feb4656748604e7ced1526bdb8982c22.tar.gz termo-88230407feb4656748604e7ced1526bdb8982c22.tar.xz termo-88230407feb4656748604e7ced1526bdb8982c22.zip |
Adjust termkey_strpkey() API more like strptime(); return pointer to end of recognised section, allows for stream parsing
Diffstat (limited to 'termkey_strpkey.3')
-rw-r--r-- | termkey_strpkey.3 | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/termkey_strpkey.3 b/termkey_strpkey.3 index 9d91dc0..e8544f9 100644 --- a/termkey_strpkey.3 +++ b/termkey_strpkey.3 @@ -5,7 +5,7 @@ termkey_strpkey \- parse a string representing a key event .nf .B #include <termkey.h> .sp -.BI "size_t termkey_strpkey(TermKey *" tk ", const char *" str ", +.BI "char *termkey_strpkey(TermKey *" tk ", const char *" str ", .BI " TermKeyKey " key ", TermKeyFormat " format ); .fi .sp @@ -26,13 +26,7 @@ Use the name "Meta" or the letter "M" instead of "Alt" or "A". .PP The \fBTERMKEY_FORMAT_WRAPBRACKET\fP and \fBTERMKEY_FORMAT_MOUSE_POS\fP options are currently not supported by \fBtermkey_strpkey\fP(). When returning a \fBTERMKEY_TYPE_UNICODE\fP key structure, this function will fill in the \fIutf8\fP member. .SH "RETURN VALUE" -\fBtermkey_strpkey\fP() returns one of the following constants: -.TP -.B TERMKEY_RES_KEY -A key structure was successfully parsed. -.TP -.B TERMKEY_RES_NONE -No key was recognised in the string buffer. +After a successful parse, \fBtermkey_strpkey\fP() returns a pointer to the first character of the input it did not consume. If the input string contains more characters then this will point at the first character beyond. If the entire input string was consumed, then this will point at a null byte. If \fBtermkey_strpkey\fP() fails to parse, it returns \fBNULL\fP. After a failed parse, the \fIkey\fP structure may contain partial or invalid results. The structure will only be valid if the function returns a non-\fBNULL\fP result. .SH "SEE ALSO" .BR termkey_new (3), .BR termkey_strfkey (3) |