diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2012-03-04 20:40:54 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2012-03-04 20:40:54 +0000 |
commit | 178a20718c007a254611d4f02c4c6f3ca7184d8d (patch) | |
tree | 76316e5c7d7af67a925ed8a8c477b0da0cced7e0 | |
parent | 30f4c30ca3ff53684282c83384796d600eae7e74 (diff) | |
download | rtmux-178a20718c007a254611d4f02c4c6f3ca7184d8d.tar.gz rtmux-178a20718c007a254611d4f02c4c6f3ca7184d8d.tar.bz2 rtmux-178a20718c007a254611d4f02c4c6f3ca7184d8d.zip |
Accept hex values as keys, needed for send-keys, based on a diff from
George Nachman.
-rw-r--r-- | key-string.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/key-string.c b/key-string.c index 08cf0b9c..e06a71eb 100644 --- a/key-string.c +++ b/key-string.c @@ -137,6 +137,15 @@ int key_string_lookup_string(const char *string) { int key, modifiers; + u_short u; + int size; + + /* Is this a hexadecimal value? */ + if (string[0] == '0' && string[1] == 'x') { + if (sscanf(string + 2, "%hx%n", &u, &size) != 1 || size > 4) + return (KEYC_NONE); + return (u); + } /* Check for modifiers. */ modifiers = 0; |