From cf11809cd45ecd2d1998d2404ff91ab747b89307 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Wed, 7 Mar 2012 13:38:26 +0000 Subject: [PATCH] Sync OpenBSD patchset 1040: 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 e2224d18..df177399 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;