better error handling
[mmh] / uip / sortm.c
index 56fa7cb..061ae5a 100644 (file)
@@ -331,6 +331,10 @@ get_fields(char *datesw, int msg, struct smsg *smsg)
        }
        for (compnum = 1, state = FLD2;; compnum++) {
                switch (state = m_getfld2(state, &f, in)) {
+               case LENERR2:
+                       admonish(NULL, "To long header field in message %d (header %s, #%d)", msg, f.name, compnum);
+                       state = FLD2;
+                       /* FALL */
                case FLD2:
                        if (mh_strcasecmp(f.name, datesw)==0) {
                                datecomp = mh_xstrdup(f.value);
@@ -350,7 +354,6 @@ get_fields(char *datesw, int msg, struct smsg *smsg)
                case FILEEOF2:
                        break;
 
-               case LENERR2:
                case FMTERR2:
                case IOERR2:
                        admonish(NULL, "format error in message %d (header #%d)", msg, compnum);