aboutsummaryrefslogtreecommitdiffstats
path: root/kbx/kbxutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'kbx/kbxutil.c')
-rw-r--r--kbx/kbxutil.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/kbx/kbxutil.c b/kbx/kbxutil.c
index 7769b834e..45f23d23b 100644
--- a/kbx/kbxutil.c
+++ b/kbx/kbxutil.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>
@@ -33,14 +32,12 @@
#include <gpg-error.h>
#include "../common/logging.h"
-#include "../common/argparse.h"
#include "../common/stringhelp.h"
#include "../common/utf8conv.h"
#include "../common/i18n.h"
#include "keybox-defs.h"
#include "../common/init.h"
#include <gcrypt.h>
-#include "../common/argparse.h" /* temporary hack. */
enum cmd_and_opt_values {
@@ -71,7 +68,7 @@ enum cmd_and_opt_values {
};
-static ARGPARSE_OPTS opts[] = {
+static gpgrt_opt_t opts[] = {
{ 300, NULL, 0, N_("@Commands:\n ") },
/* { aFindByFpr, "find-by-fpr", 0, "|FPR| find key using it's fingerprnt" }, */
@@ -108,27 +105,31 @@ int keybox_errors_seen = 0;
static const char *
my_strusage( int level )
{
- const char *p;
- switch( level ) {
- case 11: p = "kbxutil (@GNUPG@)";
- break;
- case 13: p = VERSION; break;
- case 17: p = PRINTABLE_OS_NAME; break;
- case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break;
-
- case 1:
- case 40: p =
- _("Usage: kbxutil [options] [files] (-h for help)");
- break;
- case 41: p =
- _("Syntax: kbxutil [options] [files]\n"
- "List, export, import Keybox data\n");
- break;
-
-
- default: p = NULL;
+ const char *p;
+
+ switch (level)
+ {
+ case 9: p = "GPL-3.0-or-later"; break;
+ case 11: p = "kbxutil (@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;
+
+ case 1:
+ case 40: p =
+ _("Usage: kbxutil [options] [files] (-h for help)");
+ break;
+ case 41: p =
+ _("Syntax: kbxutil [options] [files]\n"
+ "List, export, import Keybox data\n");
+ break;
+
+
+ default: p = NULL;
}
- return p;
+ return p;
}
@@ -465,15 +466,15 @@ import_openpgp (const char *filename, int dryrun)
int
-main( int argc, char **argv )
+main (int argc, char **argv)
{
- ARGPARSE_ARGS pargs;
+ gpgrt_argparse_t pargs;
enum cmd_and_opt_values cmd = 0;
unsigned long from = 0, to = ULONG_MAX;
int dry_run = 0;
early_system_init ();
- set_strusage( my_strusage );
+ gpgrt_set_strusage( my_strusage );
gcry_control (GCRYCTL_DISABLE_SECMEM);
log_set_prefix ("kbxutil", GPGRT_LOG_WITH_PREFIX);
@@ -491,8 +492,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 (gpgrt_argparse (NULL,&pargs, opts))
{
switch (pargs.r_opt)
{
@@ -527,6 +528,7 @@ main( int argc, char **argv )
break;
}
}
+ gpgrt_argparse (NULL, &pargs, NULL);
if (to < from)
log_error ("record number of \"--to\" is lower than \"--from\" one\n");