diff options
Diffstat (limited to 'tests/run-keylist.c')
| -rw-r--r-- | tests/run-keylist.c | 18 | 
1 files changed, 17 insertions, 1 deletions
| diff --git a/tests/run-keylist.c b/tests/run-keylist.c index c0c72022..8abdf43d 100644 --- a/tests/run-keylist.c +++ b/tests/run-keylist.c @@ -45,6 +45,7 @@ show_usage (int ex)           "  --verbose        run in verbose mode\n"           "  --openpgp        use the OpenPGP protocol (default)\n"           "  --cms            use the CMS protocol\n" +         "  --secret         list only secret keys\n"           "  --local          use GPGME_KEYLIST_MODE_LOCAL\n"           "  --extern         use GPGME_KEYLIST_MODE_EXTERN\n"           "  --sigs           use GPGME_KEYLIST_MODE_SIGS\n" @@ -52,6 +53,7 @@ show_usage (int ex)           "  --ephemeral      use GPGME_KEYLIST_MODE_EPHEMERAL\n"           "  --validate       use GPGME_KEYLIST_MODE_VALIDATE\n"           "  --import         import all keys\n" +         "  --offline        use offline mode\n"           , stderr);    exit (ex);  } @@ -70,6 +72,8 @@ main (int argc, char **argv)    gpgme_key_t keyarray[100];    int keyidx = 0;    gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP; +  int only_secret = 0; +  int offline = 0;    if (argc)      { argc--; argv++; } @@ -99,6 +103,11 @@ main (int argc, char **argv)            protocol = GPGME_PROTOCOL_CMS;            argc--; argv++;          } +      else if (!strcmp (*argv, "--secret")) +        { +          only_secret = 1; +          argc--; argv++; +        }        else if (!strcmp (*argv, "--local"))          {            mode |= GPGME_KEYLIST_MODE_LOCAL; @@ -134,6 +143,11 @@ main (int argc, char **argv)            import = 1;            argc--; argv++;          } +      else if (!strcmp (*argv, "--offline")) +        { +          offline = 1; +          argc--; argv++; +        }        else if (!strncmp (*argv, "--", 2))          show_usage (1); @@ -150,7 +164,9 @@ main (int argc, char **argv)    gpgme_set_keylist_mode (ctx, mode); -  err = gpgme_op_keylist_start (ctx, argc? argv[0]:NULL, 0); +  gpgme_set_offline (ctx, offline); + +  err = gpgme_op_keylist_start (ctx, argc? argv[0]:NULL, only_secret);    fail_if_err (err);    while (!(err = gpgme_op_keylist_next (ctx, &key))) | 
