diff options
Diffstat (limited to 'test/color_set.c')
-rw-r--r-- | test/color_set.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/test/color_set.c b/test/color_set.c index 016b993313f3..5510a0fdba44 100644 --- a/test/color_set.c +++ b/test/color_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2020,2020,2022 Thomas E. Dickey * * Copyright 2003-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,7 +27,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: color_set.c,v 1.10 2020/02/02 23:34:34 tom Exp $ + * $Id: color_set.c,v 1.12 2022/12/10 23:36:59 tom Exp $ */ #include <test.priv.h> @@ -36,11 +36,46 @@ #define SHOW(n) ((n) == ERR ? "ERR" : "OK") +static void +usage(int ok) +{ + static const char *msg[] = + { + "Usage: color_set [options]" + ,"" + ,USAGE_COMMON + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(ok ? EXIT_SUCCESS : EXIT_FAILURE); +} +/* *INDENT-OFF* */ +VERSION_COMMON() +/* *INDENT-ON* */ + int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { NCURSES_COLOR_T f, b; + int ch; + + while ((ch = getopt(argc, argv, OPTS_COMMON)) != -1) { + switch (ch) { + case OPTS_VERSION: + show_version(argv); + ExitProgram(EXIT_SUCCESS); + default: + usage(ch == OPTS_USAGE); + /* NOTREACHED */ + } + } + if (optind < argc) + usage(FALSE); + setlocale(LC_ALL, ""); initscr(); cbreak(); noecho(); |