X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fnewdemo.c;h=04c52751c570814d90b4f96e635e66022c9e971c;hp=462e340bc8a42493e813ddc550e620f2fcfbe503;hb=8d8a3537cd58af7879c6e1921235daeed2b74926;hpb=5d8dbcdd9423bf9821db414fd9ec792ccf1f1027 diff --git a/test/newdemo.c b/test/newdemo.c index 462e340b..04c52751 100644 --- a/test/newdemo.c +++ b/test/newdemo.c @@ -2,7 +2,7 @@ * newdemo.c - A demo program using PDCurses. The program illustrate * the use of colours for text output. * - * $Id: newdemo.c,v 1.44 2017/09/04 11:49:55 tom Exp $ + * $Id: newdemo.c,v 1.46 2019/08/24 23:02:49 tom Exp $ */ #include @@ -61,11 +61,12 @@ static int WaitForUser(WINDOW *win) { time_t t; - chtype key; nodelay(win, TRUE); t = time((time_t *) 0); + while (1) { + chtype key; if ((int) (key = (chtype) wgetch(win)) != ERR) { if (key == 'q' || key == 'Q') return 1; @@ -221,18 +222,14 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { WINDOW *win; - int w, x, y, i, j, k; + int x, y, i, k; char buffer[SIZEOF(messages) * 80]; - const char *message; int width, height; chtype save[80]; - chtype c; setlocale(LC_ALL, ""); - CATCHALL(trap); - - initscr(); + InitAndCatch(initscr(), trap); if (has_colors()) start_color(); cbreak(); @@ -246,6 +243,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) } while (1) { + int w; + int j; + chtype c; + const char *message; + set_colors(win, 1, COLOR_WHITE, COLOR_BLUE); werase(win);