diff options
Diffstat (limited to 'tools/gpgconf.c')
-rw-r--r-- | tools/gpgconf.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/gpgconf.c b/tools/gpgconf.c index a6094400b..14137ddcd 100644 --- a/tools/gpgconf.c +++ b/tools/gpgconf.c @@ -16,12 +16,11 @@ * * 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> -/* We don't want to have the macros from gpgrt here until we have - * completely replaced this module by the one from gpgrt. */ -#undef GPGRT_ENABLE_ARGPARSE_MACROS + #include <errno.h> #include <stdio.h> #include <stdlib.h> @@ -34,7 +33,6 @@ #include "../common/sysutils.h" #include "../common/init.h" #include "../common/status.h" -#include "../common/argparse.h" /* temporary hack. */ /* Constants to identify the commands and options. */ @@ -74,7 +72,7 @@ enum cmd_and_opt_values /* The list of commands and options. */ -static ARGPARSE_OPTS opts[] = +static gpgrt_opt_t opts[] = { { 300, NULL, 0, N_("@Commands:\n ") }, @@ -133,9 +131,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; @@ -541,7 +541,7 @@ int main (int argc, char **argv) { gpg_error_t err; - ARGPARSE_ARGS pargs; + gpgrt_argparse_t pargs; const char *fname; int no_more_options = 0; enum cmd_and_opt_values cmd = 0; @@ -550,7 +550,7 @@ main (int argc, char **argv) early_system_init (); gnupg_reopen_std (GPGCONF_NAME); - set_strusage (my_strusage); + gpgrt_set_strusage (my_strusage); log_set_prefix (GPGCONF_NAME, GPGRT_LOG_WITH_PREFIX); /* Make sure that our subsystems are ready. */ @@ -561,17 +561,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 && gpgrt_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,6 +603,8 @@ main (int argc, char **argv) } } + gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */ + if (log_get_errorcount (0)) gpgconf_failure (GPG_ERR_USER_2); |