[syslinux:master] keyname: better handling of named control characters
syslinux-bot for H. Peter Anvin
hpa at linux.intel.com
Mon Apr 18 13:54:19 PDT 2011
Commit-ID: eb27a41b4ad733a53efd576534426334b389d2ae
Gitweb: http://syslinux.zytor.com/commit/eb27a41b4ad733a53efd576534426334b389d2ae
Author: H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Mon, 11 Apr 2011 15:41:26 -0700
Committer: H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Mon, 11 Apr 2011 15:41:26 -0700
keyname: better handling of named control characters
Named control character (Tab, Enter, Backspace etc.) should use those
names rather than caret sequences.
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
---
com32/libutil/keyname.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/com32/libutil/keyname.c b/com32/libutil/keyname.c
index 6aebbd5..3b9e658 100644
--- a/com32/libutil/keyname.c
+++ b/com32/libutil/keyname.c
@@ -110,10 +110,8 @@ const char *key_code_to_name(int key)
if (key < 0)
return NULL;
- if (key < 0x100 && key != ' ') {
- if (key == 0x7f) {
- return "^?";
- } else if (key & 0x60) {
+ if (key > ' ' && key < 0x100) {
+ if (key & 0x60) {
buf[0] = key;
buf[1] = '\0';
} else {
@@ -129,5 +127,12 @@ const char *key_code_to_name(int key)
return name->string;
}
+ if (key < ' ') {
+ buf[0] = '^';
+ buf[1] = key | 0x40;
+ buf[2] = '\0';
+ return buf;
+ }
+
return NULL;
}
More information about the Syslinux-commits
mailing list