From 292ad55fbef698de9e6e8c66b10bbcdc2a39e212 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 4 Oct 2007 00:18:59 +0000 Subject: List keys command. --- key-string.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'key-string.c') 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 @@ -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); +} -- cgit