#include <sys/types.h>
+#include <ctype.h>
#include <dirent.h>
#include <err.h>
#include <stdio.h>
#endif
enum {
- FROMLEN = 6, /* "From: " */
- SUBJLEN = 9, /* "Subject: " */
+ FROMLEN = 5, /* "From:" */
+ SUBJLEN = 8, /* "Subject:" */
/* Number of characters for each field we actually output. This
* must also be changed in the printf functions at the end of the
}
--len;
- if (len > FROMLEN && strncmp(line, "From: ", FROMLEN) == 0) {
+ if (len > FROMLEN && strncasecmp(line, "From:", FROMLEN) == 0) {
line += FROMLEN;
len -= FROMLEN;
+ while (len > 0 && isspace(line[0])) {
+ line++;
+ len--;
+ }
if (len < FROMCOUNT) {
fromcount = len;
} else {
}
strncpy(fromheader, line, fromcount);
fromheader[fromcount] = '\0';
- } else if (len > SUBJLEN && strncmp(line, "Subject: ", SUBJLEN) == 0) {
+ } else if (len > SUBJLEN && strncasecmp(line, "Subject:", SUBJLEN) == 0) {
line += SUBJLEN;
len -= SUBJLEN;
+ while (len > 0 && isspace(line[0])) {
+ line++;
+ len--;
+ }
if (len < SUBJCOUNT) {
subjcount = len;
} else {