mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
31 lines
561 B
Awk
31 lines
561 B
Awk
|
|
BEGIN {
|
|
print ""
|
|
print "#include <stdlib.h>"
|
|
print "#include \"curses.h\""
|
|
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 ""
|
|
}
|