summaryrefslogtreecommitdiff
path: root/dselect/kt.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dselect/kt.cc')
-rw-r--r--dselect/kt.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/dselect/kt.cc b/dselect/kt.cc
new file mode 100644
index 000000000..d448a5878
--- /dev/null
+++ b/dselect/kt.cc
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <ncurses/curses.h>
+
+struct kd { int v; const char *n; } kds[]= {
+#include "curkeys.inc"
+};
+
+int main(int argc, char **argv) {
+ int n=0, c, y,x;
+ struct kd *kdp;
+
+ initscr(); cbreak(); noecho(); nonl();
+ keypad(stdscr,TRUE);
+ getmaxyx(stdscr,y,x);
+ mvprintw(5,5,"q to quit; b to beep; (y%d x%d)",y,x);
+
+ for (;;) {
+ refresh();
+ c= getch(); if (c==ERR) { endwin(); perror("err"); exit(1); }
+ for (kdp=kds; kdp->v != -1 && kdp->v != c; kdp++);
+ n++; mvprintw(10 + (n%4),10,"n %10d keycode %4d %-10s F0 + %4d",n,c,
+ kdp->n, c-KEY_F0);
+ if (c == 'q') break;
+ if (c == 'b') beep();
+ }
+ endwin();
+ return 0;
+}