X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fredraw.c;h=569c2769a98dda0a005b63dc4ea0689676728abd;hp=b74c6e53739c9ec6d141c3794d9df89656ac8106;hb=5079dc1dbbaa5128ac761358dcf81c8b606983c4;hpb=5e1e572b71ae31a6071daa24e2460a68a6f1003c diff --git a/test/redraw.c b/test/redraw.c index b74c6e53..569c2769 100644 --- a/test/redraw.c +++ b/test/redraw.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2006-2012,2017 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 2006-2012,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +27,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: redraw.c,v 1.9 2017/04/15 19:57:47 tom Exp $ + * $Id: redraw.c,v 1.11 2020/02/02 23:34:34 tom Exp $ * * Demonstrate the redrawwin() and wredrawln() functions. * Thomas Dickey - 2006/11/4 @@ -185,10 +186,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);