summaryrefslogtreecommitdiffstats
path: root/from.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-08-25 22:33:07 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-08-25 22:33:07 +0000
commit986ab5e943db7aaed2aed98f8b74e4c26666fdd8 (patch)
tree58cfec1114686823dbdbf22cf2ca52f77eb1075d /from.c
parent9044dd4d58af4b4d64a6e68b7b76c42d317e7ce5 (diff)
CVS branch clean-up.
Diffstat (limited to 'from.c')
-rw-r--r--from.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/from.c b/from.c
index 4279f9a8..f5d29749 100644
--- a/from.c
+++ b/from.c
@@ -62,7 +62,8 @@ time_t is_from (const char *s, char *path, size_t pathlen)
struct tm tm;
int yr;
- *path = 0;
+ if (path)
+ *path = 0;
if (strncmp ("From ", s, 5) != 0)
return 0;
@@ -102,11 +103,14 @@ time_t is_from (const char *s, char *path, size_t pathlen)
if ((p = strchr (s, ' ')) == NULL)
return 0;
}
- len = (size_t) (p - s);
- if (len + 1 > pathlen)
- len = pathlen - 1;
- memcpy (path, s, len);
- path[len] = 0;
+ if (path)
+ {
+ len = (size_t) (p - s);
+ if (len + 1 > pathlen)
+ len = pathlen - 1;
+ memcpy (path, s, len);
+ path[len] = 0;
+ }
s = p + 1;
SKIPWS (s);
@@ -156,7 +160,7 @@ time_t is_from (const char *s, char *path, size_t pathlen)
if (!*s) return 0;
/* timezone? */
- if (isalpha (*s) || *s == '+' || *s == '-')
+ if (isalpha ((unsigned char) *s) || *s == '+' || *s == '-')
{
s = next_word (s);
if (!*s) return 0;
@@ -165,7 +169,7 @@ time_t is_from (const char *s, char *path, size_t pathlen)
* some places have two timezone fields after the time, e.g.
* From xxxx@yyyyyyy.fr Wed Aug 2 00:39:12 MET DST 1995
*/
- if (isalpha (*s))
+ if (isalpha ((unsigned char) *s))
{
s = next_word (s);
if (!*s) return 0;