summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-03-04 20:40:54 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-03-04 20:40:54 +0000
commit178a20718c007a254611d4f02c4c6f3ca7184d8d (patch)
tree76316e5c7d7af67a925ed8a8c477b0da0cced7e0 /key-string.c
parent30f4c30ca3ff53684282c83384796d600eae7e74 (diff)
Accept hex values as keys, needed for send-keys, based on a diff from
George Nachman.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c9
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;