]> ncurses.scripts.mit.edu Git - ncurses.git/blob - test/keynames.c
ncurses 5.5
[ncurses.git] / test / keynames.c
1 /*
2  * $Id: keynames.c,v 1.7 2005/04/30 20:13:59 tom Exp $
3  */
4
5 #include <test.priv.h>
6
7 int
8 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
9 {
10     int n;
11
12     /*
13      * Get the terminfo entry into memory, and tell ncurses that we want to
14      * use function keys.  That will make it add any user-defined keys that
15      * appear in the terminfo.
16      */
17     newterm(getenv("TERM"), stderr, stdin);
18     keypad(stdscr, TRUE);
19     endwin();
20
21     for (n = -1; n < KEY_MAX + 512; n++) {
22         const char *result = keyname(n);
23         if (result != 0)
24             printf("%d(%5o):%s\n", n, n, result);
25     }
26     ExitProgram(EXIT_SUCCESS);
27 }