summaryrefslogtreecommitdiff
path: root/src/gpgme-tool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpgme-tool.c')
-rw-r--r--src/gpgme-tool.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c
index d42179b..e5e5707 100644
--- a/src/gpgme-tool.c
+++ b/src/gpgme-tool.c
@@ -3054,7 +3054,7 @@ cmd_import (assuan_context_t ctx, char *line)
static const char hlp_export[] =
- "EXPORT [--extern] [--minimal] [<pattern>]\n"
+ "EXPORT [--extern] [--minimal] [--secret [--pkcs12] [--raw]] [<pattern>]\n"
"\n"
"Export the keys described by PATTERN. Write the\n"
"the output to the object set by the last OUTPUT command.";
@@ -3082,6 +3082,12 @@ cmd_export (assuan_context_t ctx, char *line)
mode |= GPGME_EXPORT_MODE_EXTERN;
if (has_option (line, "--minimal"))
mode |= GPGME_EXPORT_MODE_MINIMAL;
+ if (has_option (line, "--secret"))
+ mode |= GPGME_EXPORT_MODE_SECRET;
+ if (has_option (line, "--raw"))
+ mode |= GPGME_EXPORT_MODE_RAW;
+ if (has_option (line, "--pkcs12"))
+ mode |= GPGME_EXPORT_MODE_PKCS12;
line = skip_options (line);
@@ -3728,6 +3734,7 @@ static char args_doc[] = "COMMAND [OPTIONS...]";
static struct argp_option options[] = {
{ "server", 's', 0, 0, "Server mode" },
{ "gpg-binary", 501, "FILE", 0, "Use FILE for the GPG backend" },
+ { "lib-version", 502, 0, 0, "Show library version" },
{ 0 }
};
@@ -3736,7 +3743,7 @@ static struct argp argp = { options, parse_options, args_doc, doc };
struct args
{
- enum { CMD_DEFAULT, CMD_SERVER } cmd;
+ enum { CMD_DEFAULT, CMD_SERVER, CMD_LIBVERSION } cmd;
const char *gpg_binary;
};
@@ -3762,6 +3769,11 @@ parse_options (int key, char *arg, struct argp_state *state)
case 501:
args->gpg_binary = arg;
break;
+
+ case 502:
+ args->cmd = CMD_LIBVERSION;
+ break;
+
#if 0
case ARGP_KEY_ARG:
if (state->arg_num >= 2)
@@ -3787,6 +3799,7 @@ main (int argc, char *argv[])
struct args args;
struct gpgme_tool gt;
gpg_error_t err;
+ int needgt = 1;
#ifdef HAVE_SETLOCALE
setlocale (LC_ALL, "");
@@ -3804,7 +3817,10 @@ main (int argc, char *argv[])
argp_parse (&argp, argc, argv, 0, 0, &args);
log_init ();
- if (args.gpg_binary)
+ if (args.cmd == CMD_LIBVERSION)
+ needgt = 0;
+
+ if (needgt && args.gpg_binary)
{
if (access (args.gpg_binary, X_OK))
err = gpg_error_from_syserror ();
@@ -3816,7 +3832,8 @@ main (int argc, char *argv[])
args.gpg_binary);
}
- gt_init (&gt);
+ if (needgt)
+ gt_init (&gt);
switch (args.cmd)
{
@@ -3824,9 +3841,17 @@ main (int argc, char *argv[])
case CMD_SERVER:
gpgme_server (&gt);
break;
+
+ case CMD_LIBVERSION:
+ printf ("Version from header: %s (0x%06x)\n",
+ GPGME_VERSION, GPGME_VERSION_NUMBER);
+ printf ("Version from binary: %s\n", gpgme_check_version (NULL));
+ printf ("Copyright blurb ...:%s\n", gpgme_check_version ("\x01\x01"));
+ break;
}
- gpgme_release (gt.ctx);
+ if (needgt)
+ gpgme_release (gt.ctx);
#ifdef HAVE_W32CE_SYSTEM
/* Give the buggy ssh server time to flush the output buffers. */