X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fmovewindow.c;fp=test%2Fmovewindow.c;h=11521a0722388bc06fd9bbe728eb9d5d7915a3ce;hp=b855942832c7ed97ab19f688e181b19a7042dc51;hb=91fa4688e82518794fcf0c32a36f3fcca5e4c2d5;hpb=6b4de0a4ef55b9505f6d46f0d9886ab0ca30cffe diff --git a/test/movewindow.c b/test/movewindow.c index b8559428..11521a07 100644 --- a/test/movewindow.c +++ b/test/movewindow.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: movewindow.c,v 1.36 2012/09/01 23:54:00 tom Exp $ + * $Id: movewindow.c,v 1.37 2012/10/27 19:37:56 tom Exp $ * * Demonstrate move functions for windows and derived windows from the curses * library. @@ -79,6 +79,14 @@ static void tail_line(CONST_FMT char *fmt,...) GCC_PRINTFLIKE(1, 2); static unsigned num_windows; static FRAME *all_windows; +static void +failed(const char *s) +{ + perror(s); + endwin(); + ExitProgram(EXIT_FAILURE); +} + static void message(int lineno, CONST_FMT char *fmt, va_list argp) { @@ -305,6 +313,8 @@ add_window(WINDOW *parent, WINDOW *child) keypad(child, TRUE); if (need > have) { all_windows = typeRealloc(FRAME, need, all_windows); + if (!all_windows) + failed("add_window"); } all_windows[num_windows].parent = parent; all_windows[num_windows].child = child;