move some decoding functions right into the str module, with a bit more
[apps/madmutt.git] / smime.c
diff --git a/smime.c b/smime.c
index 6a2486d..5a8f7e7 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -83,10 +83,19 @@ static char SmimeIntermediateToUse[_POSIX_PATH_MAX];
 
 
 /*
- *     Queries and passphrase handling.
+ * Create a format string to be used with scanf.
+ * To use it, write, for instance, MUTT_FORMAT(HUGE_STRING).
+ * 
+ * See K&R 2nd ed, p. 231 for an explanation.
  */
+#define _MUTT_FORMAT_2(a,b)    "%" a  b
+#define _MUTT_FORMAT_1(a, b)   _MUTT_FORMAT_2(#a, b)
+#define MUTT_FORMAT(a)         _MUTT_FORMAT_1(a, "s")
 
 
+/*
+ *     Queries and passphrase handling.
+ */
 
 
 /* these are copies from pgp.c */
@@ -148,7 +157,7 @@ static const char *_mutt_fmt_smime_command (char *dest,
         char buf1[LONG_STRING], buf2[LONG_STRING];
         struct stat sb;
 
-        strfcpy (path, NONULL (SmimeCALocation), sizeof (path));
+        m_strcpy(path, sizeof(path), NONULL(SmimeCALocation));
         mutt_expand_path (path, sizeof (path));
         mutt_quote_filename (buf1, sizeof (buf1), path);
 
@@ -553,7 +562,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
             continue;
           }
           else if (choice == M_YES) {
-            strfcpy (key, fields[1], sizeof (key));
+            m_strcpy(key, sizeof(key), fields[1]);
             ask = 0;
             break;
           }
@@ -561,7 +570,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
         else {
           if (public)
             key_trust_level = *fields[4];
-          strfcpy (key, fields[1], sizeof (key));
+          m_strcpy(key, sizeof(key), fields[1]);
         }
         found = 1;
       }
@@ -577,13 +586,13 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
         if (numFields >= 3 &&
             !(m_strncasecmp(query, fields[2], query_len))) {
           ask = 0;
-          strfcpy (key, fields[1], sizeof (key));
+          m_strcpy(key, sizeof(key), fields[1]);
         }
         /* query = certificate: return intermediate certificate. */
         else if (numFields >= 4 &&
                  !(m_strncasecmp(query, fields[1], query_len))) {
           ask = 0;
-          strfcpy (key, fields[3], sizeof (key));
+          m_strcpy(key, sizeof(key), fields[3]);
         }
       }