aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keylist.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-07-24 12:12:37 +0000
committerWerner Koch <[email protected]>2025-07-24 12:15:08 +0000
commite3cc410003a91e7ab4c267e1285c0c4c57775be9 (patch)
treeb7e3a38721ce846352ce76bf4d277f5972eaa6ac /g10/keylist.c
parentgpgsm: Fix caching of the trustlist's flags. (diff)
downloadgnupg-e3cc410003a91e7ab4c267e1285c0c4c57775be9.tar.gz
gnupg-e3cc410003a91e7ab4c267e1285c0c4c57775be9.zip
gpgv: New option --print-notation.
* g10/keylist.c (print_matching_notations): New. * g10/mainproc.c (check_sig_and_print): Call this. * g10/options.h (opt): Add field print_notations. * g10/gpgv.c (oPrintNotation): New. (opts): Add "print-notation". (main): Implement. -- I had the code floating around but can't remember what triggered me to write this. But it might eventually be useful, so better apply it.
Diffstat (limited to 'g10/keylist.c')
-rw-r--r--g10/keylist.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/g10/keylist.c b/g10/keylist.c
index 1c531126f..42e9f65f5 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -709,6 +709,41 @@ show_notation (PKT_signature * sig, int indent, int mode, int which)
}
+/* Output all the notation data in SIG matching a name given by
+ * --print-notation to stdout. */
+void
+print_matching_notations (PKT_signature *sig)
+{
+ notation_t nd, notations;
+ strlist_t sl;
+ const char *s;
+
+ if (!opt.print_notations)
+ return;
+
+ notations = sig_to_notation (sig);
+ for (nd = notations; nd; nd = nd->next)
+ {
+ for (sl=opt.print_notations; sl; sl = sl->next)
+ if (!strcmp (sl->d, nd->name))
+ break;
+ if (!sl || !*nd->value)
+ continue;
+ es_fprintf (es_stdout, "%s: ", nd->name);
+ for (s = nd->value; *s; s++)
+ {
+ if (*s == '\n')
+ es_fprintf (es_stdout, "\n%*s", (int)strlen (nd->name)+2, "");
+ else if (*s >= ' ' || *s != '\t')
+ es_putc (*s, es_stdout);
+ }
+ es_putc ('\n', es_stdout);
+ }
+
+ free_notation (notations);
+}
+
+
static void
print_signature_stats (struct keylist_context *s)
{