X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fkeynames.c;h=7dd944e621367046927164772b05b1ee28cd19cf;hp=ee8fac89f9ec921356b4be52e81b6c28f2e3a9af;hb=55ccd2b959766810cf7db8d1c4462f338ce0afc8;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01;ds=sidebyside diff --git a/test/keynames.c b/test/keynames.c index ee8fac89..7dd944e6 100644 --- a/test/keynames.c +++ b/test/keynames.c @@ -1,5 +1,5 @@ /* - * $Id: keynames.c,v 1.4 2002/09/01 19:42:42 tom Exp $ + * $Id: keynames.c,v 1.7 2005/04/30 20:13:59 tom Exp $ */ #include @@ -8,8 +8,18 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { int n; - for (n = -1; n < 512; n++) { - char *result = keyname(n); + + /* + * Get the terminfo entry into memory, and tell ncurses that we want to + * use function keys. That will make it add any user-defined keys that + * appear in the terminfo. + */ + newterm(getenv("TERM"), stderr, stdin); + keypad(stdscr, TRUE); + endwin(); + + for (n = -1; n < KEY_MAX + 512; n++) { + const char *result = keyname(n); if (result != 0) printf("%d(%5o):%s\n", n, n, result); }