diff options
Diffstat (limited to 'test/chgat.c')
| -rw-r--r-- | test/chgat.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/test/chgat.c b/test/chgat.c index 2c2b539120c4..18bc9e9c4e79 100644 --- a/test/chgat.c +++ b/test/chgat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2022 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2006-2012,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,16 +27,17 @@ * authorization. * ****************************************************************************/ /* - * $Id: chgat.c,v 1.20 2022/12/10 23:31:31 tom Exp $ + * $Id: chgat.c,v 1.25 2025/07/05 15:21:56 tom Exp $ * * test-driver for chgat/wchgat/mvchgat/mvwchgat */ #include <test.priv.h> -#include <popup_msg.h> #if HAVE_CHGAT +#include <popup_msg.h> + #define SHOW(n) ((n) == ERR ? "ERR" : "OK") #define COLOR_DEFAULT (-1) @@ -76,7 +77,7 @@ color_params(size_t state, short *pair) }; /* *INDENT-ON* */ - const char *result = 0; + const char *result = NULL; if (has_colors()) { static bool first = TRUE; @@ -113,7 +114,7 @@ video_params(size_t state, attr_t *attr) }; /* *INDENT-ON* */ - const char *result = 0; + const char *result = NULL; if (state < SIZEOF(table)) { *attr = table[state].attr; @@ -150,24 +151,24 @@ show_status(WINDOW *win, STATUS * sp) getyx(win, y, x); wmove(win, 0, 0); wprintw(win, "Count %d", sp->count); - if (sp->v_msg != 0) + if (sp->v_msg != NULL) wprintw(win, " Video %s", sp->v_msg); - if (sp->c_msg != 0) + if (sp->c_msg != NULL) wprintw(win, " Color %s", sp->c_msg); wclrtoeol(win); wmove(win, y, x); } static void -do_subwindow(WINDOW *win, STATUS * sp, void func(WINDOW *)) +do_subwindow(WINDOW *win, const STATUS * sp, void func(WINDOW *)) { WINDOW *win1 = newwin(sp->y_max - 2, sp->x_max - 2, sp->y_beg + 1, sp->x_beg + 1); - if (win1 != 0 && sp->y_max > 4 && sp->x_max > 4) { + if (win1 != NULL && sp->y_max > 4 && sp->x_max > 4) { WINDOW *win2 = derwin(win1, sp->y_max - 4, sp->x_max - 4, 1, 1); - if (win2 != 0) { + if (win2 != NULL) { box(win1, 0, 0); wrefresh(win1); func(win2); @@ -179,7 +180,7 @@ do_subwindow(WINDOW *win, STATUS * sp, void func(WINDOW *)) delwin(win1); touchwin(win); } else { - if (win1 != 0) + if (win1 != NULL) delwin(win1); beep(); } @@ -203,7 +204,7 @@ init_status(WINDOW *win, STATUS * sp) static void show_help(WINDOW *win) { - static const char *msgs[] = + static NCURSES_CONST char *msgs[] = { "Basic commands:" ,"Use h/j/k/l or arrow keys to move the cursor." @@ -217,7 +218,7 @@ show_help(WINDOW *win) ,"= resets count to zero." ,"- negates count." ,"? shows this help-window" - ,0 + ,NULL }; popup_msg(win, msgs); @@ -229,14 +230,14 @@ update_status(WINDOW *win, STATUS * sp) switch (sp->ch) { case ' ': /* next test-iteration */ if (has_colors()) { - if ((sp->c_msg = color_params(++(sp->c), &(sp->pair))) == 0) { + if ((sp->c_msg = color_params(++(sp->c), &(sp->pair))) == NULL) { sp->c_msg = color_params(sp->c = 0, &(sp->pair)); - if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) { + if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == NULL) { sp->v_msg = video_params(sp->v = 0, &(sp->attr)); } } } else { - if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) { + if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == NULL) { sp->v_msg = video_params(sp->v = 0, &(sp->attr)); } } @@ -375,11 +376,8 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, OPTS_COMMON)) != -1) { switch (ch) { - case OPTS_VERSION: - show_version(argv); - ExitProgram(EXIT_SUCCESS); default: - usage(ch == OPTS_USAGE); + CASE_COMMON; /* NOTREACHED */ } } |
