summaryrefslogtreecommitdiff
path: root/lib/libcurses/MKkeyname.awk
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-06-02 06:06:27 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-06-02 06:06:27 +0000
commit97548ea6b6ae9322fb78df90b7633d40df4e11df (patch)
treeab5a82d85a6c89f0dfdb1e44cc10cc6d80167d0c /lib/libcurses/MKkeyname.awk
parent4eae3aa9e113650162ffb0bbb09e47503936e77e (diff)
Install ncurses as -lcurses and <curses.h>
Install BSD curses library as -locurses and <ocurses.h>
Diffstat (limited to 'lib/libcurses/MKkeyname.awk')
-rw-r--r--lib/libcurses/MKkeyname.awk31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/libcurses/MKkeyname.awk b/lib/libcurses/MKkeyname.awk
new file mode 100644
index 00000000000..4d03ae95e23
--- /dev/null
+++ b/lib/libcurses/MKkeyname.awk
@@ -0,0 +1,31 @@
+
+BEGIN {
+ print ""
+ print "#include <stdlib.h>"
+ print "#include \"curses.h\""
+ print "#include \"term.h\""
+ print ""
+ print "struct kn {"
+ print "\tchar *name;"
+ print "\tint code;"
+ print "};"
+ print ""
+ print "const struct kn key_names[] = {"
+}
+
+{printf "\t{\"%s\", %s,},\n", $1, $2;}
+
+END {
+ print "};"
+ print ""
+ print "const char *keyname(int c)"
+ print "{"
+ print "int i, size = sizeof(key_names)/sizeof(struct kn);"
+ print ""
+ print "\tfor (i = 0; i < size; i++) {"
+ print "\t\tif (key_names[i].code == c) return key_names[i].name;"
+ print "\t}"
+ print "\treturn NULL;"
+ print "}"
+ print ""
+}