summaryrefslogtreecommitdiff
path: root/test/dots_xcurses.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dots_xcurses.c')
-rw-r--r--test/dots_xcurses.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/test/dots_xcurses.c b/test/dots_xcurses.c
index b4b52193d262..1e6ca4d09d55 100644
--- a/test/dots_xcurses.c
+++ b/test/dots_xcurses.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2022,2023 Thomas E. Dickey *
+ * Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -30,13 +30,13 @@
/*
* Author: Thomas E. Dickey
*
- * $Id: dots_xcurses.c,v 1.29 2023/01/07 17:21:48 tom Exp $
+ * $Id: dots_xcurses.c,v 1.34 2025/08/08 16:45:28 tom Exp $
*
* A simple demo of the wide-curses interface used for comparison with termcap.
*/
#include <test.priv.h>
-#if !defined(_NC_WINDOWS)
+#if !defined(_NC_WINDOWS_NATIVE)
#include <sys/time.h>
#endif
@@ -54,6 +54,7 @@
static bool interrupted = FALSE;
static long total_chars = 0;
+static long total_skips = 0;
static time_t started;
#if HAVE_ALLOC_PAIR
@@ -69,6 +70,8 @@ cleanup(void)
fprintf(stderr, "\n\n%ld total cells, rate %.2f/sec\n",
total_chars,
((double) (total_chars) / (double) (time((time_t *) 0) - started)));
+ if (total_skips)
+ fprintf(stderr, "%ld total skipped\n", total_skips);
}
static void
@@ -91,6 +94,7 @@ mypair(int fg, int bg)
#if HAVE_ALLOC_PAIR
if (x_option) {
result = alloc_pair(fg, bg);
+ assert(result < COLOR_PAIRS);
} else
#endif
{
@@ -106,6 +110,8 @@ set_colors(int fg, int bg)
int pair = mypair(fg, bg);
if (pair > 0) {
(void) color_set((short) pair, NewPair(pair));
+ } else {
+ ++total_skips;
}
}
@@ -120,7 +126,7 @@ usage(int ok)
,"Options:"
," -T TERM override $TERM"
#if HAVE_USE_DEFAULT_COLORS
- ," -d invoke use_default_colors()"
+ ," -d invoke use_default_colors"
#endif
#if HAVE_USE_ENV
," -e allow environment $LINES / $COLUMNS"
@@ -192,17 +198,14 @@ main(int argc, char *argv[])
x_option = TRUE;
break;
#endif
- case OPTS_VERSION:
- show_version(argv);
- ExitProgram(EXIT_SUCCESS);
default:
- usage(ch == OPTS_USAGE);
+ CASE_COMMON;
/* NOTREACHED */
}
}
setlocale(LC_ALL, "");
- srand((unsigned) time(0));
+ srand((unsigned) time(NULL));
SetupAlarm(r_option);
InitAndCatch(initscr(), onsig);
@@ -228,6 +231,8 @@ main(int argc, char *argv[])
pair = mypair(fg, bg);
if (pair > 0) {
InitPair(pair, fg, bg);
+ } else {
+ ++total_skips;
}
}
}