From 257661d6ae0ca376df758c38fabab2316d10e3a9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 6 Jun 2018 11:50:58 +0200 Subject: gpg: New command --show-keys. * g10/gpg.c (aShowKeys): New const. (opts): New command --show-keys. (main): Implement command. * g10/import.c (import_keys_internal): Don't print stats in show-only mode. (import_one): Be silent in show-only mode. -- Using --import --import-options show-only to look at a key is too cumbersome. Provide this shortcut and also remove some diagnostic cruft in this case. Signed-off-by: Werner Koch --- g10/gpg.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'g10/gpg.c') diff --git a/g10/gpg.c b/g10/gpg.c index 70bdddfda..499c00537 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -150,6 +150,7 @@ enum cmd_and_opt_values aSearchKeys, aRefreshKeys, aFetchKeys, + aShowKeys, aExport, aExportSecret, aExportSecretSub, @@ -500,6 +501,7 @@ static ARGPARSE_OPTS opts[] = { N_("update all keys from a keyserver")), ARGPARSE_c (aLocateKeys, "locate-keys", "@"), ARGPARSE_c (aFetchKeys, "fetch-keys" , "@" ), + ARGPARSE_c (aShowKeys, "show-keys" , "@" ), ARGPARSE_c (aExportSecret, "export-secret-keys" , "@" ), ARGPARSE_c (aExportSecretSub, "export-secret-subkeys" , "@" ), ARGPARSE_c (aExportSshKey, "export-ssh-key", "@" ), @@ -740,6 +742,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_c (aListKeys, "list-key", "@"), /* alias */ ARGPARSE_c (aListSigs, "list-sig", "@"), /* alias */ ARGPARSE_c (aCheckKeys, "check-sig", "@"), /* alias */ + ARGPARSE_c (aShowKeys, "show-key", "@"), /* alias */ ARGPARSE_s_n (oSkipVerify, "skip-verify", "@"), ARGPARSE_s_n (oSkipHiddenRecipients, "skip-hidden-recipients", "@"), ARGPARSE_s_n (oNoSkipHiddenRecipients, "no-skip-hidden-recipients", "@"), @@ -2642,6 +2645,13 @@ main (int argc, char **argv) greeting=1; break; + case aShowKeys: + set_cmd (&cmd, pargs.r_opt); + opt.import_options |= IMPORT_SHOW; + opt.import_options |= IMPORT_DRY_RUN; + opt.import_options &= ~IMPORT_REPAIR_KEYS; + break; + case aDetachedSign: detached_sig = 1; set_cmd( &cmd, aSign ); break; case aDecryptFiles: multifile=1; /* fall through */ @@ -4638,6 +4648,7 @@ main (int argc, char **argv) case aFastImport: opt.import_options |= IMPORT_FAST; /* fall through */ case aImport: + case aShowKeys: import_keys (ctrl, argc? argv:NULL, argc, NULL, opt.import_options, opt.key_origin, opt.key_origin_url); break; -- cgit v1.2.3 From d2bc66f241a66cc95140cbb3a07555f6301290ed Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 11 Jun 2018 08:46:37 +0200 Subject: gpg: Set some list options with --show-keys * g10/gpg.c (main): Set some list options. -- The new command --show-keys is commonly used to check the content of a file with keys. In this case it can be expected that all included subkeys and uids are of interested, even when they are already expired or have been revoked. Signed-off-by: Werner Koch --- g10/gpg.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'g10/gpg.c') diff --git a/g10/gpg.c b/g10/gpg.c index 499c00537..8effc535c 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -2650,6 +2650,10 @@ main (int argc, char **argv) opt.import_options |= IMPORT_SHOW; opt.import_options |= IMPORT_DRY_RUN; opt.import_options &= ~IMPORT_REPAIR_KEYS; + opt.list_options |= LIST_SHOW_UNUSABLE_UIDS; + opt.list_options |= LIST_SHOW_UNUSABLE_SUBKEYS; + opt.list_options |= LIST_SHOW_NOTATIONS; + opt.list_options |= LIST_SHOW_POLICY_URLS; break; case aDetachedSign: detached_sig = 1; set_cmd( &cmd, aSign ); break; -- cgit v1.2.3 From cb52eb76b3ba0269742c5322e10a2b5151dafaf2 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 12 Jun 2018 16:11:19 +0200 Subject: Some preparations to eventuallt use gpgrt_argparse. * configure.ac (GNUPG_DEF_COPYRIGHT_LINE: New. * tools/watchgnupg.c (print_version): USe this macro. * common/init.c (_init_common_subsystems): Register argparse functions. Signed-off-by: Werner Koch --- g10/gpg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'g10/gpg.c') diff --git a/g10/gpg.c b/g10/gpg.c index 8effc535c..600f8440d 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -3625,7 +3625,7 @@ main (int argc, char **argv) else { pargs.err = ARGPARSE_PRINT_ERROR; - /* The argparse fucntion calls a plain exit and thus + /* The argparse function calls a plain exit and thus * we need to print a status here. */ write_status_failure ("option-parser", gpg_error(GPG_ERR_GENERAL)); -- cgit v1.2.3