ncursesw-morphos/test/testscanw.c

41 lines
838 B
C
Raw Normal View History

1998-03-01 12:21:12 +08:00
/* gleaned from a web-search, shows a bug combining scanw and implicit scroll.
* Date: 1997/03/17
* From: bayern@morpheus.cis.yale.edu
*
2004-02-09 10:15:26 +08:00
* $Id: testscanw.c,v 1.10 2002/10/19 22:11:24 tom Exp $
1998-03-01 12:21:12 +08:00
*/
#include <test.priv.h>
2002-10-13 11:35:53 +08:00
int
main(int argc, char *argv[])
1998-03-01 12:21:12 +08:00
{
2002-10-13 11:35:53 +08:00
long badanswer = 1;
long *response = &badanswer;
1998-03-01 12:21:12 +08:00
2002-10-13 11:35:53 +08:00
setlocale(LC_ALL, "");
initscr();
scrollok(stdscr, TRUE);
idlok(stdscr, TRUE);
echo();
1998-03-01 12:21:12 +08:00
#if 0
2002-10-13 11:35:53 +08:00
trace(TRACE_UPDATE | TRACE_CALLS);
1998-03-01 12:21:12 +08:00
#endif
2002-10-13 11:35:53 +08:00
while (argc > 1) {
if (isdigit(UChar(*argv[1])))
move(atoi(argv[1]), 0);
else if (!strcmp(argv[1], "-k"))
keypad(stdscr, TRUE);
argc--, argv++;
}
1998-03-01 12:21:12 +08:00
2002-10-13 11:35:53 +08:00
while (badanswer) {
printw("Enter a number (0 to quit):\n");
printw("--> ");
scanw("%20ld", response); /* yes, it's a pointer */
}
endwin();
ExitProgram(EXIT_SUCCESS);
1998-03-01 12:21:12 +08:00
}