Add ncurses 5.4 source code.
[dragonfly.git] / contrib / ncurses-5.4 / test / testscanw.c
1 /* gleaned from a web-search, shows a bug combining scanw and implicit scroll.
2  * Date:  1997/03/17
3  * From:  bayern@morpheus.cis.yale.edu
4  *
5  * $Id: testscanw.c,v 1.10 2002/10/19 22:11:24 tom Exp $
6  */
7 #include <test.priv.h>
8
9 int
10 main(int argc, char *argv[])
11 {
12     long badanswer = 1;
13     long *response = &badanswer;
14
15     setlocale(LC_ALL, "");
16
17     initscr();
18     scrollok(stdscr, TRUE);
19     idlok(stdscr, TRUE);
20     echo();
21
22 #if 0
23     trace(TRACE_UPDATE | TRACE_CALLS);
24 #endif
25     while (argc > 1) {
26         if (isdigit(UChar(*argv[1])))
27             move(atoi(argv[1]), 0);
28         else if (!strcmp(argv[1], "-k"))
29             keypad(stdscr, TRUE);
30         argc--, argv++;
31     }
32
33     while (badanswer) {
34         printw("Enter a number (0 to quit):\n");
35         printw("--> ");
36         scanw("%20ld", response);       /* yes, it's a pointer */
37     }
38     endwin();
39     ExitProgram(EXIT_SUCCESS);
40 }