[PATCH GnuPG 4/5] compliance: add gnupg_compliance_label

Daniel Kahn Gillmor via Gnupg-devel <[email protected]>
Newsgroups gmane.comp.encryption.gpg.devel
Message-ID <[email protected]>
* common/compliance.c (gnupg_compliance_label) new function,
prototyped...
* common/compliance.h: ...here.

---

This will be useful when we need to display the current compliance
mode to the user.

Signed-off-by: Daniel Kahn Gillmor <[email protected]>
---
 common/compliance.c | 7 +++++++
 common/compliance.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/common/compliance.c b/common/compliance.c
index 6c271c199..9707f3a20 100644
--- a/common/compliance.c
+++ b/common/compliance.c
@@ -782,6 +782,13 @@ gnupg_parse_compliance_option (const char *string,
   return -1;
 }
 
+/* Return label for the given COMPLIANCE mode.  */
+const char *
+gnupg_compliance_label (enum gnupg_compliance_mode compliance)
+{
+  /* just offset by strlen("--compliance=") */
+  return gnupg_compliance_option_string (compliance) + 13;
+}
 
 /* Return the command line option for the given COMPLIANCE mode.  */
 const char *
diff --git a/common/compliance.h b/common/compliance.h
index 111fdc74b..2ddf38f83 100644
--- a/common/compliance.h
+++ b/common/compliance.h
@@ -91,6 +91,8 @@ int gnupg_parse_compliance_option (const char *string,
                                    int quiet);
 const char *gnupg_compliance_option_string (enum gnupg_compliance_mode
                                             compliance);
+const char *gnupg_compliance_label (enum gnupg_compliance_mode
+                                    compliance);
 
 void gnupg_set_compliance_extra_info (unsigned int min_rsa);
 
-- 
2.47.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.