]> ncurses.scripts.mit.edu Git - ncurses.git/blob - test/testscanw.c
ncurses 5.3
[ncurses.git] / 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.9 2002/06/29 23:32:18 tom Exp $
6  */
7 #include <test.priv.h>
8 #include <ctype.h>
9
10 int
11 main(int argc, char *argv[])
12 {
13     long badanswer = 1;
14     long *response = &badanswer;
15
16     setlocale(LC_ALL, "");
17
18     initscr();
19     scrollok(stdscr, TRUE);
20     idlok(stdscr, TRUE);
21     echo();
22
23 #if 0
24     trace(TRACE_UPDATE | TRACE_CALLS);
25 #endif
26     while (argc > 1) {
27         if (isdigit(UChar(*argv[1])))
28             move(atoi(argv[1]), 0);
29         else if (!strcmp(argv[1], "-k"))
30             keypad(stdscr, TRUE);
31         argc--, argv++;
32     }
33
34     while (badanswer) {
35         printw("Enter a number (0 to quit):\n");
36         printw("--> ");
37         scanw("%20ld", response);       /* yes, it's a pointer */
38     }
39     endwin();
40     ExitProgram(EXIT_SUCCESS);
41 }