From: Werner Koch Date: Tue, 4 Jun 2002 14:01:11 +0000 (+0000) Subject: * gpgsm/t-encrypt.c (main): Add a simple option parser and allow X-Git-Tag: gpgme-0-3-8~35 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9a3eae2c5e8a82c1efc5287d4498e12768fb7a94;p=gpgme.git * gpgsm/t-encrypt.c (main): Add a simple option parser and allow to specify an encryption key. --- diff --git a/tests/ChangeLog b/tests/ChangeLog index c511ae1..e1538b3 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2002-06-04 Werner Koch + + * gpgsm/t-encrypt.c (main): Add a simple option parser and allow + to specify an encryption key. + 2002-05-26 Marcus Brinkmann * gpg/Makefile.am (all-local): Remove dependency on ./secring.gpg. diff --git a/tests/gpgsm/t-encrypt.c b/tests/gpgsm/t-encrypt.c index bec71eb..9a7358c 100644 --- a/tests/gpgsm/t-encrypt.c +++ b/tests/gpgsm/t-encrypt.c @@ -71,6 +71,25 @@ main (int argc, char **argv ) GpgmeError err; GpgmeData in, out; GpgmeRecipients rset; + int loop = 0; + + /* simple option parser; ignoring unknown options */ + if (argc) + { + argc--; + argv++; + } + while (argc && **argv == '-' ) + { + if (!strcmp (*argv, "--loop")) + loop++; + + argc--; + argv++; + if (!strcmp (argv[-1], "--")) + break; + } + err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); fail_if_err (err); @@ -90,7 +109,11 @@ main (int argc, char **argv ) err = gpgme_recipients_new (&rset); fail_if_err (err); - err = gpgme_recipients_add_name_with_validity (rset, + if (argc) + err = gpgme_recipients_add_name_with_validity (rset, *argv, + GPGME_VALIDITY_FULL); + else + err = gpgme_recipients_add_name_with_validity (rset, "/CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=Düsseldorf,C=DE", GPGME_VALIDITY_FULL); fail_if_err (err); @@ -108,7 +131,7 @@ main (int argc, char **argv ) gpgme_data_release (in); gpgme_data_release (out); gpgme_release (ctx); - } while ( argc > 1 && !strcmp( argv[1], "--loop" ) ); + } while (loop); return 0; }