/****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
+ * Copyright 2020,2022 Thomas E. Dickey *
+ * Copyright 1998-2013,2014 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 *
* This is an example written by Alexander V. Lukyanov <lav@yars.free.net>,
* to demonstrate an inconsistency between ncurses and SVr4 curses.
*
- * $Id: testaddch.c,v 1.12 2014/08/02 23:11:20 tom Exp $
+ * $Id: testaddch.c,v 1.15 2022/12/10 23:44:18 tom Exp $
*/
#include <test.priv.h>
addch(((unsigned char) (*s++)) | a);
}
+static void
+usage(int ok)
+{
+ static const char *msg[] =
+ {
+ "Usage: testaddch [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[])
{
unsigned i;
chtype back, set, attr;
+ 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, "");