diff options
author | Werner Koch <[email protected]> | 2020-02-21 19:28:47 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-02-21 19:28:47 +0000 |
commit | 3bc004decd289810bc1b6ad6fb8f47e45c770ce6 (patch) | |
tree | f6e161cc838bfaacbfc647ff5f68ed04d977105f /tools/gpgsplit.c | |
parent | Use gpgrt's new option parser for gpgc, gpgsm, and gpg-agent. (diff) | |
download | gnupg-3bc004decd289810bc1b6ad6fb8f47e45c770ce6.tar.gz gnupg-3bc004decd289810bc1b6ad6fb8f47e45c770ce6.zip |
Use gpgrt's new option parser for the tools.
* agent/preset-passphrase.c: Switch to the new option parser.
* agent/protect-tool.c: Ditto.
* kbx/kbxutil.c: Ditto.
* tools/gpg-card.c: Ditto.
* tools/gpg-check-pattern.c: Ditto.
* tools/gpg-connect-agent.c: Ditto.
* tools/gpg-pair-tool.c: Ditto.
* tools/gpg-wks-client.c: Ditto.
* tools/gpg-wks-server.c: Ditto.
* tools/gpgconf.c: Ditto.
* tools/gpgsplit.c: Ditto.
* tools/gpgtar.c: Ditto.
--
This is another part of changes. A followup patch will address the
remaining daemons.
GnuPG-bug-id: 4788
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tools/gpgsplit.c')
-rw-r--r-- | tools/gpgsplit.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tools/gpgsplit.c b/tools/gpgsplit.c index 8b65c89c5..7257b63e1 100644 --- a/tools/gpgsplit.c +++ b/tools/gpgsplit.c @@ -15,12 +15,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> @@ -42,7 +41,6 @@ #define INCLUDED_BY_MAIN_MODULE 1 #include "../common/util.h" #include "../common/openpgpdefs.h" -#include "../common/argparse.h" /* temporary hack. */ #ifdef HAVE_BZIP2 # include <bzlib.h> @@ -70,7 +68,7 @@ enum cmd_and_opt_values { }; -static ARGPARSE_OPTS opts[] = { +static gpgrt_opt_t opts[] = { { 301, NULL, 0, "@Options:\n " }, @@ -90,9 +88,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; @@ -115,19 +115,22 @@ my_strusage (int level) int main (int argc, char **argv) { - ARGPARSE_ARGS pargs; + gpgrt_argparse_t pargs; #ifdef HAVE_DOSISH_SYSTEM setmode( fileno(stdin), O_BINARY ); setmode( fileno(stdout), O_BINARY ); #endif log_set_prefix ("gpgsplit", GPGRT_LOG_WITH_PREFIX); - set_strusage (my_strusage); + gpgrt_set_strusage (my_strusage); + /* Register our string mapper with gpgrt. Usually done in + * init_common_subsystems, but we don't need that here. */ + gpgrt_set_fixed_string_mapper (map_static_macro_string); 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 (gpgrt_argparse (NULL, &pargs, opts)) { switch (pargs.r_opt) { @@ -139,6 +142,7 @@ main (int argc, char **argv) default : pargs.err = 2; break; } } + gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */ if (log_get_errorcount(0)) g10_exit (2); |