1994-10-07 08:58:58 +00:00
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
print ""
|
|
|
|
print "#include <stdlib.h>"
|
1994-12-02 06:40:24 +00:00
|
|
|
print "#include \"curses.h\""
|
1994-10-07 08:58:58 +00:00
|
|
|
print ""
|
|
|
|
print "struct kn {"
|
|
|
|
print "\tchar *name;"
|
|
|
|
print "\tint code;"
|
|
|
|
print "};"
|
|
|
|
print ""
|
|
|
|
print "struct kn key_names[] = {"
|
|
|
|
}
|
|
|
|
|
|
|
|
{printf "\t{\"%s\", %s,},\n", $1, $2;}
|
|
|
|
|
|
|
|
END {
|
|
|
|
print "};"
|
|
|
|
print ""
|
|
|
|
print "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 ""
|
|
|
|
}
|