* gpgsm/t-keylist.c (doit): Add arg SECRET.

(main): Add option --secret.
This commit is contained in:
Werner Koch 2002-09-30 08:03:56 +00:00
parent 57add1098d
commit d256945205
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2002-09-30 Werner Koch <wk@gnupg.org>
* gpgsm/t-keylist.c (doit): Add arg SECRET.
(main): Add option --secret.
2002-09-28 Marcus Brinkmann <marcus@g10code.de> 2002-09-28 Marcus Brinkmann <marcus@g10code.de>
* t-version.c: Include <string.h>. Reported by Stéphane Corthésy. * t-version.c: Include <string.h>. Reported by Stéphane Corthésy.

View File

@ -33,12 +33,12 @@
} while(0) } while(0)
static void static void
doit ( GpgmeCtx ctx, const char *pattern ) doit ( GpgmeCtx ctx, const char *pattern, int secret )
{ {
GpgmeError err; GpgmeError err;
GpgmeKey key; GpgmeKey key;
err = gpgme_op_keylist_start (ctx, pattern, 0 ); err = gpgme_op_keylist_start (ctx, pattern, secret );
fail_if_err (err); fail_if_err (err);
while ( !(err = gpgme_op_keylist_next ( ctx, &key )) ) { while ( !(err = gpgme_op_keylist_next ( ctx, &key )) ) {
@ -147,6 +147,7 @@ main (int argc, char **argv )
GpgmeCtx ctx; GpgmeCtx ctx;
GpgmeError err; GpgmeError err;
int loop = 0; int loop = 0;
int secret = 0;
const char *pattern; const char *pattern;
if( argc ) { if( argc ) {
@ -157,6 +158,10 @@ main (int argc, char **argv )
loop = 1; loop = 1;
argc--; argv++; argc--; argv++;
} }
if (argc && !strcmp( *argv, "--secret" ) ) {
secret = 1;
argc--; argv++;
}
pattern = argc? *argv : NULL; pattern = argc? *argv : NULL;
err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS);
@ -169,7 +174,7 @@ main (int argc, char **argv )
gpgme_set_keylist_mode (ctx, 1); /* no validity calculation */ gpgme_set_keylist_mode (ctx, 1); /* no validity calculation */
do { do {
fprintf (stderr, "** pattern=`%s'\n", pattern ); fprintf (stderr, "** pattern=`%s'\n", pattern );
doit ( ctx, pattern ); doit ( ctx, pattern, secret );
} while ( loop ); } while ( loop );
gpgme_release (ctx); gpgme_release (ctx);