Use m_tempfile and better errors msg
[apps/madmutt.git] / from.c
diff --git a/from.c b/from.c
index 37ae147..5931789 100644 (file)
--- a/from.c
+++ b/from.c
@@ -7,16 +7,7 @@
  * please see the file GPL in the top level source directory.
  */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <ctype.h>
-#include <string.h>
-
-#include <lib-lib/mem.h>
-#include <lib-lib/str.h>
-#include <lib-lib/macros.h>
+#include <lib-lib/lib-lib.h>
 
 #include "mutt.h"
 
@@ -60,6 +51,7 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
     return 0;
 
   s = m_strnextsp(s);            /* skip over the From part. */
+  s = skipspaces(s);
   if (!*s)
     return 0;
 
@@ -99,6 +91,7 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
   }
 
   s = m_strnextsp(s);
+  s = skipspaces(s);
   if (!*s)
     return 0;
 
@@ -108,6 +101,7 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
    */
   if (is_day_name (s)) {
     s = m_strnextsp(s);
+    s = skipspaces(s);
     if (!*s)
       return 0;
   }
@@ -118,6 +112,7 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
 
   /* day */
   s = m_strnextsp(s);
+  s = skipspaces(s);
   if (!*s)
     return 0;
   if (sscanf (s, "%d", &tm.tm_mday) != 1)
@@ -125,6 +120,7 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
 
   /* time */
   s = m_strnextsp(s);
+  s = skipspaces(s);
   if (!*s)
     return 0;
 
@@ -136,12 +132,14 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
     return 0;
 
   s = m_strnextsp(s);
+  s = skipspaces(s);
   if (!*s)
     return 0;
 
   /* timezone? */
   if (isalpha ((unsigned char) *s) || *s == '+' || *s == '-') {
     s = m_strnextsp(s);
+    s = skipspaces(s);
     if (!*s)
       return 0;
 
@@ -151,6 +149,7 @@ int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
      */
     if (isalpha ((unsigned char) *s)) {
       s = m_strnextsp(s);
+      s = skipspaces(s);
       if (!*s)
         return 0;
     }