X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Ffirework.c;h=bfeadd7c0dfe61d2bcd15c344eb8cdf78d74c05c;hp=9fb236bf806d65014b5773e133875cadd8b13ec6;hb=HEAD;hpb=12b49d3c56a6130feb2d39fbe2d6c1bc0838f0fa diff --git a/test/firework.c b/test/firework.c index 9fb236bf..54e4036c 100644 --- a/test/firework.c +++ b/test/firework.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2014,2017 Free Software Foundation, Inc. * + * 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 * * copy of this software and associated documentation files (the * @@ -26,7 +27,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: firework.c,v 1.35 2017/09/30 15:42:24 tom Exp $ + * $Id: firework.c,v 1.40 2022/12/04 00:40:11 tom Exp $ */ #include @@ -37,7 +38,7 @@ static short my_bg = COLOR_BLACK; static void cleanup(void) { - exit_curses(); + stop_curses(); } static void @@ -137,12 +138,13 @@ explode(int row, int col) } 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" @@ -153,8 +155,11 @@ usage(void) 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[]) @@ -169,19 +174,23 @@ 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();