From 178a20718c007a254611d4f02c4c6f3ca7184d8d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 4 Mar 2012 20:40:54 +0000 Subject: [PATCH] Accept hex values as keys, needed for send-keys, based on a diff from George Nachman. --- key-string.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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;