X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fnewdemo.c;h=e056ecb7fd1f7143bd6dffd813cacf82149ba934;hp=566fc47c6a6c756a1feec8c2a6b9cf1119bdc0f3;hb=07e31b3b587a07281ff7c71e5c13248a31048257;hpb=98d8891f42d8acac5c2ade39d163f386057a22e4;ds=inline diff --git a/test/newdemo.c b/test/newdemo.c index 566fc47c..e056ecb7 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.37 2012/11/17 23:27:50 tom Exp $ + * $Id: newdemo.c,v 1.43 2016/09/10 21:25:53 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; } @@ -222,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]; @@ -299,11 +299,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) message = messages[j = 0]; i = 1; w = width - 2; - strcpy(buffer, message); + _nc_STRCPY(buffer, message, sizeof(buffer)); while (j < NMESSAGES) { while ((int) strlen(buffer) < w) { - strcat(buffer, " ... "); - strcat(buffer, messages[++j % NMESSAGES]); + _nc_STRCAT(buffer, " ... ", sizeof(buffer)); + _nc_STRCAT(buffer, messages[++j % NMESSAGES], sizeof(buffer)); } if (i < w)