2 * $Id: demo_keyok.c,v 1.3 2003/05/17 23:18:34 tom Exp $
4 * Demonstrate the keyok() function.
5 * Thomas Dickey - 2002/11/23
10 #if defined(NCURSES_VERSION) && NCURSES_EXT_FUNCS
12 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
19 (void) cbreak(); /* take input chars one at a time, no wait for \n */
20 (void) noecho(); /* don't echo input */
22 printw("Typing any function key will disable it, but typing it twice in\n");
23 printw("a row will turn it back on (just for a demo).");
26 win = newwin(LINES - 2, COLS, 2, 0);
31 while ((ch = wgetch(win)) != ERR) {
32 const char *name = keyname(ch);
33 wprintw(win, "Keycode %d, name %s\n",
35 name != 0 ? name : "<null>");
41 } else if (lastch >= KEY_MIN) {
52 printf("This program requires the ncurses library\n");
53 ExitProgram(EXIT_FAILURE);