diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gpg-check-pattern.c | 10 | ||||
-rw-r--r-- | tools/gpg-connect-agent.c | 8 | ||||
-rw-r--r-- | tools/gpg-wks-client.c | 8 | ||||
-rw-r--r-- | tools/gpg-wks-server.c | 8 | ||||
-rw-r--r-- | tools/gpgconf.c | 16 | ||||
-rw-r--r-- | tools/gpgsplit.c | 10 | ||||
-rw-r--r-- | tools/gpgtar.c | 14 |
7 files changed, 51 insertions, 23 deletions
diff --git a/tools/gpg-check-pattern.c b/tools/gpg-check-pattern.c index 46b9e589d..69248a3a3 100644 --- a/tools/gpg-check-pattern.c +++ b/tools/gpg-check-pattern.c @@ -15,6 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see <https://www.gnu.org/licenses/>. + * SPDX-License-Identifier: GPL-3.0-or-later */ #include <config.h> @@ -133,9 +134,11 @@ my_strusage (int level) const char *p; switch (level) { + case 9: p = "GPL-3.0-or-later"; break; case 11: p = "gpg-check-pattern (@GnuPG@)"; break; case 13: p = VERSION; break; + case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break; @@ -176,8 +179,8 @@ main (int argc, char **argv ) pargs.argc = &argc; pargs.argv = &argv; - pargs.flags= 1; /* (do not remove the args) */ - while (arg_parse (&pargs, opts) ) + pargs.flags= ARGPARSE_FLAG_KEEP; + while (gnupg_argparse (NULL, &pargs, opts)) { switch (pargs.r_opt) { @@ -189,6 +192,8 @@ main (int argc, char **argv ) default : pargs.err = 2; break; } } + gnupg_argparse (NULL, &pargs, NULL); /* Release internal state. */ + if (log_get_errorcount(0)) exit (2); @@ -489,4 +494,3 @@ process (FILE *fp, pattern_t *patarray) if (opt.verbose) log_info ("no input line matches the pattern - accepted\n"); } - diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index 0dabdad16..250d6caa3 100644 --- a/tools/gpg-connect-agent.c +++ b/tools/gpg-connect-agent.c @@ -16,6 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see <https://www.gnu.org/licenses/>. + * SPDX-License-Identifier: GPL-3.0-or-later */ #include <config.h> @@ -195,9 +196,11 @@ my_strusage( int level ) switch (level) { + case 9: p = "GPL-3.0-or-later"; break; case 11: p = "@GPG@-connect-agent (@GNUPG@)"; break; case 13: p = VERSION; break; + case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break; @@ -1190,8 +1193,8 @@ main (int argc, char **argv) /* Parse the command line. */ pargs.argc = &argc; pargs.argv = &argv; - pargs.flags = 1; /* Do not remove the args. */ - while (!no_more_options && optfile_parse (NULL, NULL, NULL, &pargs, opts)) + pargs.flags = ARGPARSE_FLAG_KEEP; + while (!no_more_options && gnupg_argparse (NULL, &pargs, opts)) { switch (pargs.r_opt) { @@ -1219,6 +1222,7 @@ main (int argc, char **argv) default: pargs.err = 2; break; } } + gnupg_argparse (NULL, &pargs, NULL); /* Release internal state. */ if (log_get_errorcount (0)) exit (2); diff --git a/tools/gpg-wks-client.c b/tools/gpg-wks-client.c index 56768aa7e..4ebf50f39 100644 --- a/tools/gpg-wks-client.c +++ b/tools/gpg-wks-client.c @@ -16,6 +16,7 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, see <https://www.gnu.org/licenses/>. + * SPDX-License-Identifier: LGPL-2.1-or-later */ #include <config.h> @@ -159,9 +160,11 @@ my_strusage( int level ) switch (level) { + case 9: p = "LGPL-2.1-or-later"; break; case 11: p = "gpg-wks-client"; break; case 12: p = "@GNUPG@"; break; case 13: p = VERSION; break; + case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = ("Please report bugs to <@EMAIL@>.\n"); break; @@ -196,7 +199,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) enum cmd_and_opt_values cmd = 0; int no_more_options = 0; - while (!no_more_options && optfile_parse (NULL, NULL, NULL, pargs, popts)) + while (!no_more_options && gnupg_argparse (NULL, pargs, popts)) { switch (pargs->r_opt) { @@ -244,7 +247,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) cmd = pargs->r_opt; break; - default: pargs->err = 2; break; + default: pargs->err = ARGPARSE_PRINT_ERROR; break; } } @@ -277,6 +280,7 @@ main (int argc, char **argv) pargs.argv = &argv; pargs.flags = ARGPARSE_FLAG_KEEP; cmd = parse_arguments (&pargs, opts); + gnupg_argparse (NULL, &pargs, NULL); if (log_get_errorcount (0)) exit (2); diff --git a/tools/gpg-wks-server.c b/tools/gpg-wks-server.c index addafa27d..2ff53a27f 100644 --- a/tools/gpg-wks-server.c +++ b/tools/gpg-wks-server.c @@ -16,6 +16,7 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, see <https://www.gnu.org/licenses/>. + * SPDX-License-Identifier: LGPL-2.1-or-later */ /* The Web Key Service I-D defines an update protocol to store a @@ -172,9 +173,11 @@ my_strusage( int level ) switch (level) { + case 9: p = "LGPL-2.1-or-later"; break; case 11: p = "gpg-wks-server"; break; case 12: p = "@GNUPG@"; break; case 13: p = VERSION; break; + case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = ("Please report bugs to <@EMAIL@>.\n"); break; @@ -209,7 +212,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) enum cmd_and_opt_values cmd = 0; int no_more_options = 0; - while (!no_more_options && optfile_parse (NULL, NULL, NULL, pargs, popts)) + while (!no_more_options && gnupg_argparse (NULL, pargs, popts)) { switch (pargs->r_opt) { @@ -258,7 +261,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) cmd = pargs->r_opt; break; - default: pargs->err = 2; break; + default: pargs->err = ARGPARSE_PRINT_ERROR; break; } } @@ -287,6 +290,7 @@ main (int argc, char **argv) pargs.argv = &argv; pargs.flags = ARGPARSE_FLAG_KEEP; cmd = parse_arguments (&pargs, opts); + gnupg_argparse (NULL, &pargs, NULL); /* Release internal state. */ if (log_get_errorcount (0)) exit (2); diff --git a/tools/gpgconf.c b/tools/gpgconf.c index b6afc8b0e..6b499b3f9 100644 --- a/tools/gpgconf.c +++ b/tools/gpgconf.c @@ -1,6 +1,6 @@ /* gpgconf.c - Configuration utility for GnuPG * Copyright (C) 2003, 2007, 2009, 2011 Free Software Foundation, Inc. - * Copyright (C) 2016 g10 Code GmbH. + * Copyright (C) 2016, 2020 g10 Code GmbH. * * This file is part of GnuPG. * @@ -16,6 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see <https://www.gnu.org/licenses/>. + * SPDX-License-Identifier: GPL-3.0-or-later */ #include <config.h> @@ -136,9 +137,11 @@ my_strusage( int level ) switch (level) { + case 9: p = "GPL-3.0-or-later"; break; case 11: p = "@GPGCONF@ (@GNUPG@)"; break; case 13: p = VERSION; break; + case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break; @@ -564,17 +567,15 @@ main (int argc, char **argv) /* Parse the command line. */ pargs.argc = &argc; pargs.argv = &argv; - pargs.flags = 1; /* Do not remove the args. */ - while (!no_more_options && optfile_parse (NULL, NULL, NULL, &pargs, opts)) + pargs.flags = ARGPARSE_FLAG_KEEP; + while (!no_more_options && gnupg_argparse (NULL, &pargs, opts)) { switch (pargs.r_opt) { case oOutput: opt.outfile = pargs.r.ret_str; break; case oQuiet: opt.quiet = 1; break; case oDryRun: opt.dry_run = 1; break; - case oRuntime: - opt.runtime = 1; - break; + case oRuntime: opt.runtime = 1; break; case oVerbose: opt.verbose++; break; case oNoVerbose: opt.verbose = 0; break; case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break; @@ -605,9 +606,10 @@ main (int argc, char **argv) cmd = pargs.r_opt; break; - default: pargs.err = 2; break; + default: pargs.err = ARGPARSE_PRINT_ERROR; break; } } + gnupg_argparse (NULL, &pargs, NULL); /* Release internal state. */ if (log_get_errorcount (0)) gpgconf_failure (GPG_ERR_USER_2); diff --git a/tools/gpgsplit.c b/tools/gpgsplit.c index e84400854..d65348c7d 100644 --- a/tools/gpgsplit.c +++ b/tools/gpgsplit.c @@ -15,6 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see <https://www.gnu.org/licenses/>. + * SPDX-License-Identifier: GPL-3.0-or-later */ #include <config.h> @@ -86,9 +87,11 @@ my_strusage (int level) const char *p; switch (level) { + case 9: p = "GPL-3.0-or-later"; break; case 11: p = "gpgsplit (@GNUPG@)"; break; case 13: p = VERSION; break; + case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = "Please report bugs to <@EMAIL@>.\n"; break; @@ -122,8 +125,8 @@ main (int argc, char **argv) pargs.argc = &argc; pargs.argv = &argv; - pargs.flags= 1; /* do not remove the args */ - while (optfile_parse( NULL, NULL, NULL, &pargs, opts)) + pargs.flags= ARGPARSE_FLAG_KEEP; + while (gnupg_argparse (NULL, &pargs, opts)) { switch (pargs.r_opt) { @@ -132,9 +135,10 @@ main (int argc, char **argv) case oUncompress: opt_uncompress = 1; break; case oSecretToPublic: opt_secret_to_public = 1; break; case oNoSplit: opt_no_split = 1; break; - default : pargs.err = 2; break; + default : pargs.err = ARGPARSE_PRINT_ERROR; break; } } + gnupg_argparse (NULL, &pargs, NULL); /* Release internal state. */ if (log_get_errorcount(0)) g10_exit (2); diff --git a/tools/gpgtar.c b/tools/gpgtar.c index dfb2df029..c2f24ecab 100644 --- a/tools/gpgtar.c +++ b/tools/gpgtar.c @@ -1,5 +1,6 @@ /* gpgtar.c - A simple TAR implementation mainly useful for Windows. * Copyright (C) 2010 Free Software Foundation, Inc. + * Copyright (C) 2020 g10 Code GmbH * * This file is part of GnuPG. * @@ -15,6 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see <https://www.gnu.org/licenses/>. + * SPDX-License-Identifier: GPL-3.0-or-later */ /* GnuPG comes with a shell script gpg-zip which creates archive files @@ -161,9 +163,11 @@ my_strusage( int level ) switch (level) { + case 9: p = "GPL-3.0-or-later"; break; case 11: p = "@GPGTAR@ (@GNUPG@)"; break; case 13: p = VERSION; break; + case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break; @@ -314,7 +318,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) { int no_more_options = 0; - while (!no_more_options && optfile_parse (NULL, NULL, NULL, pargs, popts)) + while (!no_more_options && gnupg_argparse (NULL, pargs, popts)) { switch (pargs->r_opt) { @@ -385,7 +389,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) } break; - case oTarArgs:; + case oTarArgs: { int tar_argc; char **tar_argv; @@ -400,6 +404,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) tar_args.argv = &tar_argv; tar_args.flags = ARGPARSE_FLAG_ARG0; parse_arguments (&tar_args, tar_opts); + gnupg_argparse (NULL, &tar_args, NULL); if (tar_args.err) log_error ("unsupported tar arguments '%s'\n", pargs->r.ret_str); @@ -426,8 +431,6 @@ main (int argc, char **argv) const char *fname; ARGPARSE_ARGS pargs; - assert (sizeof (struct ustar_raw_header) == 512); - gnupg_reopen_std (GPGTAR_NAME); set_strusage (my_strusage); log_set_prefix (GPGTAR_NAME, GPGRT_LOG_WITH_PREFIX); @@ -436,11 +439,14 @@ main (int argc, char **argv) i18n_init(); init_common_subsystems (&argc, &argv); + log_assert (sizeof (struct ustar_raw_header) == 512); + /* Parse the command line. */ pargs.argc = &argc; pargs.argv = &argv; pargs.flags = ARGPARSE_FLAG_KEEP; parse_arguments (&pargs, opts); + gnupg_argparse (NULL, &pargs, NULL); if (log_get_errorcount (0)) exit (2); |