aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-01-22 22:31:09 +0000
committerTiago Cunha <tcunha@gmx.com>2011-01-22 22:31:09 +0000
commitec3a764c7635350a66b7b625421946b0e732c881 (patch)
treea6dd278d50c87d4b4ca68b085e7012e19caf93b5
parente3defd9b254696ff6d5c01b7144ab1fffcb7f2bf (diff)
downloadrtmux-ec3a764c7635350a66b7b625421946b0e732c881.tar.gz
rtmux-ec3a764c7635350a66b7b625421946b0e732c881.tar.bz2
rtmux-ec3a764c7635350a66b7b625421946b0e732c881.zip
Make bind-key accept characters with the top-bit-set and print them as octal.
-rw-r--r--key-string.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/key-string.c b/key-string.c
index e218e15c..42e40e1a 100644
--- a/key-string.c
+++ b/key-string.c
@@ -1,4 +1,4 @@
-/* $Id: key-string.c,v 1.35 2011-01-03 23:32:04 tcunha Exp $ */
+/* $Id: key-string.c,v 1.36 2011-01-22 22:31:09 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -147,7 +147,7 @@ key_string_lookup_string(const char *string)
/* Is this a standard ASCII key? */
if (string[1] == '\0') {
key = (u_char) string[0];
- if (key < 32 || key > 126)
+ if (key < 32 || key == 127 || key > 255)
return (KEYC_NONE);
} else {
/* Otherwise look the key up in the table. */
@@ -213,7 +213,7 @@ key_string_lookup_key(int key)
}
/* Invalid keys are errors. */
- if (key >= 127)
+ if (key == 127 || key > 255)
return (NULL);
/* Check for standard or control key. */
@@ -225,7 +225,9 @@ key_string_lookup_key(int key)
} else if (key >= 32 && key <= 126) {
tmp[0] = key;
tmp[1] = '\0';
- }
+ } else if (key >= 128)
+ xsnprintf(tmp, sizeof tmp, "\\%o", key);
+
strlcat(out, tmp, sizeof out);
return (out);
}