/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2020,2022 Thomas E. Dickey *
* Copyright 1998-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* authorization. *
****************************************************************************/
/*
- * $Id: firework.c,v 1.37 2020/02/02 23:34:34 tom Exp $
+ * $Id: firework.c,v 1.40 2022/12/04 00:40:11 tom Exp $
*/
#include <test.priv.h>
}
static void
-usage(void)
+usage(int ok)
{
static const char *msg[] =
{
"Usage: firework [options]"
,""
+ ,USAGE_COMMON
,"Options:"
#if HAVE_USE_DEFAULT_COLORS
," -d invoke use_default_colors, repeat to use in init_pair"
for (n = 0; n < SIZEOF(msg); n++)
fprintf(stderr, "%s\n", msg[n]);
- ExitProgram(EXIT_FAILURE);
+ ExitProgram(ok ? EXIT_SUCCESS : EXIT_FAILURE);
}
+/* *INDENT-OFF* */
+VERSION_COMMON()
+/* *INDENT-ON* */
int
main(int argc, char *argv[])
bool d_option = FALSE;
#endif
- while ((ch = getopt(argc, argv, "d")) != -1) {
+ while ((ch = getopt(argc, argv, OPTS_COMMON "d")) != -1) {
switch (ch) {
#if HAVE_USE_DEFAULT_COLORS
case 'd':
d_option = TRUE;
break;
#endif
+ case OPTS_VERSION:
+ show_version(argv);
+ ExitProgram(EXIT_SUCCESS);
default:
- usage();
+ usage(ch == OPTS_USAGE);
+ /* NOTREACHED */
}
}
if (optind < argc)
- usage();
+ usage(FALSE);
InitAndCatch(initscr(), onsig);
noecho();