about summary refs log tree commit diff
path: root/Src/Modules/curses_keys.awk
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-10-26 21:59:56 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-10-26 21:59:56 +0000
commit7f8e2298181fcbf3399eb9bde1564c1fe2fe9df3 (patch)
tree5519c693b2684c85b642f3b600eb8a83a862bd9b /Src/Modules/curses_keys.awk
parent26461dcc1b03fa0ad47c7abbec4b8999f1fe5a28 (diff)
downloadzsh-7f8e2298181fcbf3399eb9bde1564c1fe2fe9df3.tar.gz
zsh-7f8e2298181fcbf3399eb9bde1564c1fe2fe9df3.tar.xz
zsh-7f8e2298181fcbf3399eb9bde1564c1fe2fe9df3.zip
24024: add zcurses input with keypad handling
Diffstat (limited to 'Src/Modules/curses_keys.awk')
-rw-r--r--Src/Modules/curses_keys.awk19
1 files changed, 19 insertions, 0 deletions
diff --git a/Src/Modules/curses_keys.awk b/Src/Modules/curses_keys.awk
new file mode 100644
index 000000000..55a786521
--- /dev/null
+++ b/Src/Modules/curses_keys.awk
@@ -0,0 +1,19 @@
+BEGIN {nkeydefs = 0}
+
+/^[\t ]*#[\t ]*define[\t _]*KEY_[A-Z0-9_]*[\t ]/ {
+    keyindex = index($0, "KEY_")
+    keytail = substr($0, keyindex, 80)
+    split(keytail, tmp)
+    keynam = substr(tmp[1], 5, 30)
+    if (keynam != "MIN" && keynam != "MAX") {
+	name[nkeydefs++] = keynam
+    }
+}
+
+END {
+    printf("static const struct zcurses_namenumberpair keypad_names[] = {\n")
+    for (i = 0; i < 0 + nkeydefs; i++)
+        printf("    {\"%s\", KEY_%s},\n", name[i], name[i])
+    printf("    {NULL, 0}\n")
+    printf("};\n")
+}