make m_dupstr return NULL if the string was empty.
[apps/madmutt.git] / mutt_ssl.c
index 37e46b6..aeed464 100644 (file)
 #include <openssl/err.h>
 #include <openssl/rand.h>
 
-#undef _
-
 #include <string.h>
 
 #include <lib-lib/mem.h>
+#include <lib-lib/str.h>
+#include <lib-lib/macros.h>
 
 #include "mutt.h"
 #include "mutt_socket.h"
@@ -30,8 +30,6 @@
 #include "mutt_curses.h"
 #include "mutt_ssl.h"
 
-#include "lib/intl.h"
-#include "lib/str.h"
 #include "lib/debug.h"
 
 #if OPENSSL_VERSION_NUMBER >= 0x00904000L
@@ -418,7 +416,7 @@ static char *x509_get_part (char *line, const char *ndx)
 
   c = strstr (line, ndx);
   if (c) {
-    c += str_len (ndx);
+    c += m_strlen(ndx);
     c2 = strchr (c, '/');
     if (c2)
       *c2 = '\0';
@@ -437,14 +435,14 @@ static void x509_fingerprint (char *s, int l, X509 * cert)
   int j;
 
   if (!X509_digest (cert, EVP_md5 (), md, &n)) {
-    snprintf (s, l, "%s", _("[unable to calculate]"));
+    m_strcpy(s, l, _("[unable to calculate]"));
   }
   else {
     for (j = 0; j < (int) n; j++) {
       char ch[8];
 
-      snprintf (ch, 8, "%02X%s", md[j], (j % 2 ? " " : ""));
-      str_cat (s, l, ch);
+      snprintf(ch, 8, "%02X%s", md[j], (j % 2 ? " " : ""));
+      m_strcat(s, l, ch);
     }
   }
 }
@@ -638,9 +636,9 @@ static int ssl_check_certificate (sslsockdata * data)
 
   helpstr[0] = '\0';
   mutt_make_help (buf, sizeof (buf), _("Exit  "), MENU_GENERIC, OP_EXIT);
-  str_cat (helpstr, sizeof (helpstr), buf);
+  m_strcat(helpstr, sizeof(helpstr), buf);
   mutt_make_help (buf, sizeof (buf), _("Help"), MENU_GENERIC, OP_HELP);
-  str_cat (helpstr, sizeof (helpstr), buf);
+  m_strcat(helpstr, sizeof(helpstr), buf);
   menu->help = helpstr;
 
   done = 0;