diff options
| author | Baptiste Daroussin <bapt@FreeBSD.org> | 2026-01-14 13:37:49 +0100 |
|---|---|---|
| committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2026-01-14 13:37:49 +0100 |
| commit | c5a1e08b52b2f6c05e0116d46277904b711b6bdb (patch) | |
| tree | a6ad7350d1b1100356ca59616d22c51dd29743eb /test/clip_printw.c | |
| parent | 24fa7a5107c5b75d1c197accf0305be64bc72882 (diff) | |
Vendor import ncurses 6.6vendor/ncurses/6.6vendor/ncurses
Diffstat (limited to 'test/clip_printw.c')
| -rw-r--r-- | test/clip_printw.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/test/clip_printw.c b/test/clip_printw.c index c34a1e09ff34..4ce067bd9135 100644 --- a/test/clip_printw.c +++ b/test/clip_printw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2022,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 2008-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,7 +27,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: clip_printw.c,v 1.23 2023/09/30 19:57:44 tom Exp $ + * $Id: clip_printw.c,v 1.27 2025/07/05 15:21:56 tom Exp $ * * demonstrate how to use printw with/without wrapping. */ @@ -122,7 +122,7 @@ color_params(unsigned state, int *pair) }; /* *INDENT-ON* */ - const char *result = 0; + const char *result = NULL; if (has_colors()) { static bool first = TRUE; @@ -161,7 +161,7 @@ video_params(unsigned state, attr_t *attr) }; /* *INDENT-ON* */ - const char *result = 0; + const char *result = NULL; if (state < SIZEOF(table)) { *attr = table[state].attr; @@ -201,9 +201,9 @@ show_status(WINDOW *win, STATUS * sp) wmove(win, 0, 0); wprintw(win, "Clip %s", sp->single ? "line" : "window"); 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); wprintw(win, " (%d)", sp->status); wclrtoeol(win); @@ -212,21 +212,21 @@ show_status(WINDOW *win, STATUS * sp) } 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 * MARGIN), sp->x_max - (2 * MARGIN), sp->y_beg + MARGIN, sp->x_beg + MARGIN); - 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 - (2 * MARGIN) - 2, sp->x_max - (2 * MARGIN) - 2, (win == stdscr) ? Y_BASE : Y_BASE, MARGIN); - if (win2 != 0) { + if (win2 != NULL) { box(win1, 0, 0); wrefresh(win1); func(win2); @@ -268,7 +268,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." @@ -283,7 +283,7 @@ show_help(WINDOW *win) ,". calls vw_printw at the current position with the given count." ,"= resets count to zero." ,"? shows this help-window" - ,0 + ,NULL }; popup_msg(win, msgs); @@ -297,14 +297,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)); } } @@ -396,7 +396,7 @@ test_clipping(WINDOW *win) need = (unsigned) want - 1; _nc_STRCPY(fmt, "%c%s%c", sizeof(fmt)); } - if ((buffer = typeMalloc(char, need + 1)) != 0) { + if ((buffer = typeMalloc(char, need + 1)) != NULL) { for (j = 0; j < need; ++j) { buffer[j] = (char) ('A' + (j % 26)); } @@ -444,11 +444,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 */ } } |
