X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fnewdemo.c;h=f9b6f82f6038099c042f88b03055bc4e8bb45bdc;hp=b7c5db61acfc8add1db9149d31c97d6980b4a213;hb=87f20fc6e737084b06b6343c8c7206404daec4a2;hpb=b6d0d9ad9e372e856f01a4c283cf784a15993903 diff --git a/test/newdemo.c b/test/newdemo.c index b7c5db61..f9b6f82f 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.36 2012/06/09 19:17:29 tom Exp $ + * $Id: newdemo.c,v 1.41 2014/08/02 23:10:56 tom Exp $ */ #include @@ -47,7 +47,7 @@ static const char *messages[] = /* * Trap interrupt */ -static RETSIGTYPE +static void trap(int sig GCC_UNUSED) { endwin(); @@ -84,7 +84,7 @@ set_colors(WINDOW *win, int pair, int foreground, int background) if (pair > COLOR_PAIRS) pair = COLOR_PAIRS; init_pair((short) pair, (short) foreground, (short) background); - (void) wattrset(win, (int) COLOR_PAIR(pair)); + (void) wattrset(win, AttrArg(COLOR_PAIR(pair), 0)); } } @@ -96,7 +96,7 @@ use_colors(WINDOW *win, int pair, chtype attrs) pair = COLOR_PAIRS; attrs |= (chtype) COLOR_PAIR(pair); } - (void) wattrset(win, (int) attrs); + (void) wattrset(win, AttrArg(attrs, 0)); return attrs; } @@ -113,12 +113,19 @@ SubWinTest(WINDOW *win) getbegyx(win, by, bx); sw = w / 3; sh = h / 3; - if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) + + if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) { return 1; - if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) + } + if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) { + delwin(swin1); return 1; - if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) + } + if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) { + delwin(swin1); + delwin(swin2); return 1; + } set_colors(swin1, 8, COLOR_RED, COLOR_BLUE); werase(swin1); @@ -215,7 +222,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { WINDOW *win; int w, x, y, i, j, k; - char buffer[200]; + char buffer[SIZEOF(messages) * 80]; const char *message; int width, height; chtype save[80];