summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <aheinecke@gnupg.org>2019-05-02 10:26:44 +0200
committerAndre Heinecke <aheinecke@gnupg.org>2019-05-02 10:26:44 +0200
commit4746c5c9e2dd9a3ee471a429c19bc1f7fd1d07db (patch)
treef06e3339ea21eb516dc47526e9a019e47937f739
parent7981ec4147f3058d5b56905903456247993dc6f7 (diff)
downloadgpgme-4746c5c9e2dd9a3ee471a429c19bc1f7fd1d07db.tar.gz
tests: Add cms mode to run-import
* tests/run-import.c (show_usage): Add doc for cms / openpgp. (main): Handle protocol.
-rw-r--r--tests/run-import.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/run-import.c b/tests/run-import.c
index f464eb1d..36d9a0d5 100644
--- a/tests/run-import.c
+++ b/tests/run-import.c
@@ -44,6 +44,8 @@ show_usage (int ex)
fputs ("usage: " PGM " [options] FILENAMEs\n\n"
"Options:\n"
" --verbose run in verbose mode\n"
+ " --openpgp use the OpenPGP protocol (default)\n"
+ " --cms use the CMS protocol\n"
" --url import from given URLs\n"
" -0 URLs are delimited by a nul\n"
, stderr);
@@ -60,6 +62,7 @@ main (int argc, char **argv)
int nul_mode = 0;
gpgme_import_result_t impres;
gpgme_data_t data;
+ gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
if (argc)
{ argc--; argv++; }
@@ -88,6 +91,16 @@ main (int argc, char **argv)
nul_mode = 1;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--openpgp"))
+ {
+ protocol = GPGME_PROTOCOL_OpenPGP;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--cms"))
+ {
+ protocol = GPGME_PROTOCOL_CMS;
+ argc--; argv++;
+ }
else if (!strncmp (*argv, "--", 2))
show_usage (1);
@@ -96,11 +109,11 @@ main (int argc, char **argv)
if (!argc)
show_usage (1);
- init_gpgme (GPGME_PROTOCOL_OpenPGP);
+ init_gpgme (protocol);
err = gpgme_new (&ctx);
fail_if_err (err);
- gpgme_set_protocol (ctx, GPGME_PROTOCOL_OpenPGP);
+ gpgme_set_protocol (ctx, protocol);
for (; argc; argc--, argv++)
{