/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 2020,2022 Thomas E. Dickey *
* Copyright 2007-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* authorization. *
****************************************************************************/
/*
- * $Id: key_names.c,v 1.8 2020/02/02 23:34:34 tom Exp $
+ * $Id: key_names.c,v 1.11 2022/12/04 00:40:11 tom Exp $
*/
#include <test.priv.h>
#if USE_WIDEC_SUPPORT
static void
-usage(void)
+usage(int ok)
{
- fprintf(stderr, "Usage: key_names [-m] [-s]\n");
- ExitProgram(EXIT_FAILURE);
+ static const char *msg[] =
+ {
+ "Usage: key_names"
+ ,""
+ ,USAGE_COMMON
+ ,"Options:"
+ ," -m call meta(TRUE) in initialization"
+ ," -s call newterm, etc., to complete initialization"
+ };
+ 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, char *argv[])
{
+ int ch;
int n;
bool do_setup = FALSE;
setlocale(LC_ALL, "");
- while ((n = getopt(argc, argv, "ms")) != -1) {
- switch (n) {
+ while ((ch = getopt(argc, argv, OPTS_COMMON "ms")) != -1) {
+ switch (ch) {
case 'm':
do_meta = TRUE;
break;
case 's':
do_setup = TRUE;
break;
+ case OPTS_VERSION:
+ show_version(argv);
+ ExitProgram(EXIT_SUCCESS);
default:
- usage();
+ usage(ch == OPTS_USAGE);
/* NOTREACHED */
}
}