X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fredraw.c;h=7d06cad8aca35a45adc9e36a893196516f7fdc46;hp=b74c6e53739c9ec6d141c3794d9df89656ac8106;hb=7d6371e47006c8aef4ac94f52998a35b03bf89cf;hpb=5e1e572b71ae31a6071daa24e2460a68a6f1003c diff --git a/test/redraw.c b/test/redraw.c index b74c6e53..7d06cad8 100644 --- a/test/redraw.c +++ b/test/redraw.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: redraw.c,v 1.9 2017/04/15 19:57:47 tom Exp $ + * $Id: redraw.c,v 1.10 2017/06/24 14:04:57 tom Exp $ * * Demonstrate the redrawwin() and wredrawln() functions. * Thomas Dickey - 2006/11/4 @@ -185,10 +185,52 @@ test_redraw(WINDOW *win) } } +static void +usage(void) +{ + static const char *tbl[] = + { + "Usage: redraw [options]" + ,"" + ,"Options:" + ," -e use stderr (default stdout)" + ," -n do not initialize terminal" + }; + unsigned n; + for (n = 0; n < SIZEOF(tbl); ++n) + fprintf(stderr, "%s\n", tbl[n]); + ExitProgram(EXIT_FAILURE); +} + int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - initscr(); + int ch; + bool no_init = FALSE; + FILE *my_fp = stdout; + + while ((ch = getopt(argc, argv, "en")) != -1) { + switch (ch) { + case 'e': + my_fp = stderr; + break; + case 'n': + no_init = TRUE; + break; + default: + usage(); + break; + } + } + if (optind < argc) + usage(); + + if (no_init) { + START_TRACE(); + } else { + newterm((char *) 0, my_fp, stdin); + } + raw(); noecho(); test_redraw(stdscr);