summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-10-04 00:18:59 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-10-04 00:18:59 +0000
commit292ad55fbef698de9e6e8c66b10bbcdc2a39e212 (patch)
treea9f75ad5ad9174217b858b0a25891364f702458d /key-string.c
parent815815989a103cda0d88fa0670b774b1e3530509 (diff)
List keys command.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/key-string.c b/key-string.c
index 5740ef6b..5ce1aa59 100644
--- a/key-string.c
+++ b/key-string.c
@@ -1,4 +1,4 @@
-/* $Id: key-string.c,v 1.1 2007-10-03 11:26:34 nicm Exp $ */
+/* $Id: key-string.c,v 1.2 2007-10-04 00:18:59 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -206,7 +206,7 @@ struct {
#define NKEYSTRINGS (sizeof key_string_table / sizeof key_string_table[0])
int
-key_string_lookup(const char *string)
+key_string_lookup_string(const char *string)
{
u_int i;
@@ -221,3 +221,22 @@ key_string_lookup(const char *string)
}
return (KEYC_NONE);
}
+
+const char *
+key_string_lookup_key(int key)
+{
+ static char tmp[2];
+ u_int i;
+
+ if (key > 31 && key < 256) {
+ tmp[0] = key;
+ tmp[1] = '\0';
+ return (tmp);
+ }
+
+ for (i = 0; i < NKEYSTRINGS; i++) {
+ if (key == key_string_table[i].key)
+ return (key_string_table[i].string);
+ }
+ return (NULL);
+}