X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fnewdemo.c;h=20b26d024e4ae32e38de030572ce86c4fda6cf78;hp=e056ecb7fd1f7143bd6dffd813cacf82149ba934;hb=22a4b929f47f85588dc07fddf98b09776cec658f;hpb=e2e9c09c48b19b24979cafb2d4864f538b5ddd1c diff --git a/test/newdemo.c b/test/newdemo.c index e056ecb7..20b26d02 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.43 2016/09/10 21:25:53 tom Exp $ + * $Id: newdemo.c,v 1.45 2017/09/30 15:43:08 tom Exp $ */ #include @@ -50,7 +50,7 @@ static const char *messages[] = static void trap(int sig GCC_UNUSED) { - endwin(); + exit_curses(); ExitProgram(EXIT_FAILURE); } @@ -230,9 +230,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) setlocale(LC_ALL, ""); - CATCHALL(trap); - - initscr(); + InitAndCatch(initscr(), trap); if (has_colors()) start_color(); cbreak(); @@ -241,7 +239,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) height = 14; /* Create a drawing window */ win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); if (win == NULL) { - endwin(); + exit_curses(); ExitProgram(EXIT_FAILURE); } @@ -360,6 +358,6 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (WaitForUser(win) == 1) break; } - endwin(); + exit_curses(); ExitProgram(EXIT_SUCCESS); }