move some decoding functions right into the str module, with a bit more
[apps/madmutt.git] / sendlib.c
index a461354..7ec942c 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -121,16 +121,16 @@ static void encode_quoted (FGETCONV * fc, FILE * fout, int istext)
     }
 
     /* Escape lines that begin with/only contain "the message separator". */
-    if (linelen == 4 && !str_ncmp ("From", line, 4)) {
-      strfcpy (line, "=46rom", sizeof (line));
+    if (linelen == 4 && !m_strncmp("From", line, 4)) {
+      m_strcpy(line, sizeof(line), "=46rom");
       linelen = 6;
     }
-    else if (linelen == 4 && !str_ncmp ("from", line, 4)) {
-      strfcpy (line, "=66rom", sizeof (line));
+    else if (linelen == 4 && !m_strncmp("from", line, 4)) {
+      m_strcpy(line, sizeof(line), "=66rom");
       linelen = 6;
     }
     else if (linelen == 1 && line[0] == '.') {
-      strfcpy (line, "=2E", sizeof (line));
+      m_strcpy(line, sizeof(line), "=2E");
       linelen = 3;
     }
 
@@ -396,7 +396,7 @@ int mutt_write_mime_body (BODY * a, FILE * f)
 
       return (-1);
     }
-    strfcpy (boundary, p, sizeof (boundary));
+    m_strcpy(boundary, sizeof(boundary), p);
 
     for (t = a->parts; t; t = t->next) {
       fprintf (f, "\n--%s\n", boundary);
@@ -904,13 +904,13 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
       snprintf (buf, sizeof (buf), "%s/.mime.types", NONULL (Homedir));
       break;
     case 1:
-      strfcpy (buf, SYSCONFDIR "/muttng-mime.types", sizeof (buf));
+      m_strcpy(buf, sizeof(buf), SYSCONFDIR "/muttng-mime.types");
       break;
     case 2:
-      strfcpy (buf, PKGDATADIR "/mime.types", sizeof (buf));
+      m_strcpy(buf, sizeof(buf), PKGDATADIR "/mime.types");
       break;
     case 3:
-      strfcpy (buf, SYSCONFDIR "/mime.types", sizeof (buf));
+      m_strcpy(buf, sizeof(buf), SYSCONFDIR "/mime.types");
       break;
     default:
       debug_print (1, ("Internal error, count = %d.\n", count));
@@ -924,20 +924,19 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
           *p = 0;
 
         /* remove any leading space. */
-        ct = buf;
-        SKIPWS (ct);
+        ct = vskipspaces(buf);
 
         /* position on the next field in this line */
         if ((p = strpbrk (ct, " \t")) == NULL)
           continue;
         *p++ = 0;
-        SKIPWS (p);
+        p = vskipspaces(p);
 
         /* cycle through the file extensions */
         while ((p = strtok (p, " \t\n"))) {
           sze = m_strlen(p);
           if ((sze > cur_sze) && (szf >= sze) &&
-              (str_casecmp (path + szf - sze, p) == 0
+              (m_strcasecmp(path + szf - sze, p) == 0
                || ascii_strcasecmp (path + szf - sze, p) == 0) && (szf == sze
                                                                    || path[szf
                                                                            -
@@ -958,7 +957,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
             str_substrcpy (subtype, p, q, sizeof (subtype));
 
             if ((type = mutt_check_mime_type (ct)) == TYPEOTHER)
-              strfcpy (xtype, ct, sizeof (xtype));
+              m_strcpy(xtype, sizeof(xtype), ct);
 
             cur_sze = sze;
           }
@@ -1162,7 +1161,7 @@ char *mutt_get_body_charset (char *d, size_t dlen, BODY * b)
   if (p)
     mutt_canonical_charset (d, dlen, NONULL (p));
   else
-    strfcpy (d, "us-ascii", dlen);
+    m_strcpy(d, dlen, "us-ascii");
 
   return d;
 }
@@ -1596,8 +1595,7 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach,
   /* Add any user defined headers */
   for (; tmp; tmp = tmp->next) {
     if ((p = strchr (tmp->data, ':'))) {
-      p++;
-      SKIPWS (p);
+      p = vskipspaces(p + 1);
       if (!*p)
         continue;               /* don't emit empty fields. */
 
@@ -1642,8 +1640,7 @@ static void encode_headers (LIST * h)
       continue;
 
     i = p - h->data;
-    ++p;
-    SKIPWS (p);
+    p = vskipspaces(p + 1);
     tmp = m_strdup(p);
 
     if (!tmp)