aboutsummaryrefslogtreecommitdiff
path: root/key-string.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-03-07 13:38:26 +0000
committerTiago Cunha <tcunha@gmx.com>2012-03-07 13:38:26 +0000
commitcf11809cd45ecd2d1998d2404ff91ab747b89307 (patch)
tree43878a6ebe555cddc52065d3f6c66705187cedcb /key-string.c
parent32a6092f71623318083491c869e3c9d31b4389e1 (diff)
downloadrtmux-cf11809cd45ecd2d1998d2404ff91ab747b89307.tar.gz
rtmux-cf11809cd45ecd2d1998d2404ff91ab747b89307.tar.bz2
rtmux-cf11809cd45ecd2d1998d2404ff91ab747b89307.zip
Sync OpenBSD patchset 1040:
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 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;