From: David Levine Date: Fri, 18 Jan 2013 03:58:50 +0000 (-0600) Subject: Removed all traces of m_getfld() FLDEOF and BODYEOF states. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/a616a7953d87c3c51afcc8e693c48c37ec000edf?ds=inline;hp=--cc Removed all traces of m_getfld() FLDEOF and BODYEOF states. They were never set by m_getfld(), so all caller code that supported them was completely unexercised. --- a616a7953d87c3c51afcc8e693c48c37ec000edf diff --git a/h/mh.h b/h/mh.h index fb05fa7d..07f6508d 100644 --- a/h/mh.h +++ b/h/mh.h @@ -237,9 +237,7 @@ struct msgs { #define FMTERR (-3) /* Message Format error */ #define FLD 0 /* Field returned */ #define FLDPLUS 1 /* Field returned with more to come */ -#define FLDEOF 2 /* Field returned ending at eom */ #define BODY 3 /* Body returned with more to come */ -#define BODYEOF 4 /* Body returned ending at eom */ #define FILEEOF 5 /* Reached end of input file */ /* diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 05b9e953..fe4ee5dc 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -426,8 +426,6 @@ m_getfld (int state, unsigned char name[NAMESZ], unsigned char *buf, } switch (state) { - case FLDEOF: - case BODYEOF: case FLD: if (c == '\n' || c == '-') { /* we hit the header/body separator */ diff --git a/sbr/readconfig.c b/sbr/readconfig.c index 0efc9a5e..b8b1b357 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -63,7 +63,6 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx) switch (state = m_getfld (state, name, field, &fieldsz, ib)) { case FLD: case FLDPLUS: - case FLDEOF: np = (struct node *) mh_xmalloc (sizeof(*np)); *npp = np; *(npp = &np->n_next) = NULL; @@ -91,12 +90,9 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx) *ps->procnaddr = np->n_field; break; } - if (state == FLDEOF) - break; continue; case BODY: - case BODYEOF: adios (NULL, "no blank lines are permitted in %s", file); case FILEEOF: diff --git a/sbr/seq_read.c b/sbr/seq_read.c index 3cf8ad89..08c67445 100644 --- a/sbr/seq_read.c +++ b/sbr/seq_read.c @@ -81,7 +81,6 @@ seq_public (struct msgs *mp) switch (state = m_getfld (state, name, field, &fieldsz, fp)) { case FLD: case FLDPLUS: - case FLDEOF: if (state == FLDPLUS) { cp = getcpy (field); while (state == FLDPLUS) { @@ -94,12 +93,9 @@ seq_public (struct msgs *mp) } else { seq_init (mp, getcpy (name), trimcpy (field)); } - if (state == FLDEOF) - break; continue; case BODY: - case BODYEOF: adios (NULL, "no blank lines are permitted in %s", seqfile); /* fall */ diff --git a/uip/distsbr.c b/uip/distsbr.c index bbaeaf51..e2aaab01 100644 --- a/uip/distsbr.c +++ b/uip/distsbr.c @@ -51,7 +51,6 @@ distout (char *drft, char *msgnam, char *backup) switch (state = m_getfld (state, name, buffer, &buffersz, ifp)) { case FLD: case FLDPLUS: - case FLDEOF: if (uprf (name, "distribute-")) snprintf (name, sizeof(name), "%s%s", "Resent", &name[10]); if (uprf (name, "distribution-")) @@ -70,12 +69,9 @@ distout (char *drft, char *msgnam, char *backup) resent = add (buffer, resent); fputs (buffer, ofp); } - if (state == FLDEOF) - goto process; break; case BODY: - case BODYEOF: for (dp = buffer; *dp; dp++) if (!isspace (*dp)) { advise (NULL, BADTXT, "draft"); @@ -157,7 +153,6 @@ ready_msg (char *msgnam) switch (state = m_getfld (state, name, buffer, &buffersz, ifp)) { case FLD: case FLDPLUS: - case FLDEOF: if (uprf (name, "resent")) fprintf (ofp, "Prev-"); fprintf (ofp, "%s: %s", name, buffer); @@ -166,12 +161,9 @@ ready_msg (char *msgnam) state = m_getfld (state, name, buffer, &buffersz, ifp); fputs (buffer, ofp); } - if (state == FLDEOF) - goto process; break; case BODY: - case BODYEOF: fclose (ofp); cp = m_mktemp2(NULL, "dist", &txtfd, NULL); diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index c7164b32..12479a54 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -167,7 +167,6 @@ build_mime (char *infile, int directives) switch (state = m_getfld (state, name, buf, &bufsz, in)) { case FLD: case FLDPLUS: - case FLDEOF: compnum++; /* abort if draft has Mime-Version header field */ @@ -203,16 +202,13 @@ build_mime (char *infile, int directives) finish_field: /* if this wasn't the last header field, then continue */ - if (state != FLDEOF) - continue; - /* else fall... */ + continue; case FILEEOF: adios (NULL, "draft has empty body -- no directives!"); /* NOTREACHED */ case BODY: - case BODYEOF: fseek (in, (long) (-strlen (buf)), SEEK_CUR); break; diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c index 59e27914..5970a9d1 100644 --- a/uip/mhcachesbr.c +++ b/uip/mhcachesbr.c @@ -388,7 +388,6 @@ find_cache_aux2 (char *mapfile, char *id, char *mapname, int namelen) switch (state = m_getfld (state, name, buf, &bufsz, fp)) { case FLD: case FLDPLUS: - case FLDEOF: strncpy (mapname, name, namelen); if (state != FLDPLUS) cp = buf; @@ -412,12 +411,9 @@ find_cache_aux2 (char *mapfile, char *id, char *mapname, int namelen) lkfclose (fp, mapfile); return OK; } - if (state != FLDEOF) - continue; - /* else fall... */ + continue; case BODY: - case BODYEOF: case FILEEOF: default: break; diff --git a/uip/mhparse.c b/uip/mhparse.c index ea5400e0..ad499d01 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -280,7 +280,6 @@ get_content (FILE *in, char *file, int toplevel) switch (state = m_getfld (state, name, buf, &bufsz, in)) { case FLD: case FLDPLUS: - case FLDEOF: compnum++; /* get copies of the buffers */ @@ -297,15 +296,11 @@ get_content (FILE *in, char *file, int toplevel) /* Now add the header data to the list */ add_header (ct, np, vp); - /* continue, if this isn't the last header field */ - if (state != FLDEOF) { - ct->c_begin = ftell (in) + 1; - continue; - } - /* else fall... */ + /* continue, to see if this isn't the last header field */ + ct->c_begin = ftell (in) + 1; + continue; case BODY: - case BODYEOF: ct->c_begin = ftell (in) - strlen (buf); break; diff --git a/uip/msh.c b/uip/msh.c index 36286e0b..cc2d5efb 100644 --- a/uip/msh.c +++ b/uip/msh.c @@ -1009,7 +1009,6 @@ readid (int msgnum) int bufsz = sizeof buf; switch (state = m_getfld (state, name, buf, &bufsz, zp)) { case FLD: - case FLDEOF: case FLDPLUS: if (!mh_strcasecmp (name, BBoard_ID)) { bp = getcpy (buf); @@ -1028,8 +1027,7 @@ readid (int msgnum) while (state == FLDPLUS) bufsz = sizeof buf; state = m_getfld (state, name, buf, &bufsz, zp); - if (state != FLDEOF) - continue; + continue; default: return 0; diff --git a/uip/mshcmds.c b/uip/mshcmds.c index c2a8a3cf..cdda3c99 100644 --- a/uip/mshcmds.c +++ b/uip/mshcmds.c @@ -2440,7 +2440,6 @@ is_nontext (int msgnum) switch (state = m_getfld (state, name, buf, &bufsz, fp)) { case FLD: case FLDPLUS: - case FLDEOF: /* * Check Content-Type field */ @@ -2751,7 +2750,6 @@ get_fields (char *datesw, char *subjsw, int msgnum, struct Msg *msgp) int bufsz = sizeof buf; switch (state = m_getfld (state, name, buf, &bufsz, zp)) { case FLD: - case FLDEOF: case FLDPLUS: if (!mh_strcasecmp (name, datesw)) { bp = getcpy (buf); @@ -2792,7 +2790,6 @@ get_fields (char *datesw, char *subjsw, int msgnum, struct Msg *msgp) continue; case BODY: - case BODYEOF: case FILEEOF: break; diff --git a/uip/new.c b/uip/new.c index 198207a8..7bef56ac 100644 --- a/uip/new.c +++ b/uip/new.c @@ -109,7 +109,6 @@ get_msgnums(char *folder, char *sequences[]) switch (state = m_getfld (state, name, field, &fieldsz, fp)) { case FLD: case FLDPLUS: - case FLDEOF: if (state == FLDPLUS) { cp = getcpy (field); while (state == FLDPLUS) { @@ -149,12 +148,9 @@ get_msgnums(char *folder, char *sequences[]) } } - if (state == FLDEOF) - break; continue; case BODY: - case BODYEOF: adios (NULL, "no blank lines are permitted in %s", seqfile); /* fall */ diff --git a/uip/picksbr.c b/uip/picksbr.c index d03e72be..5fa73189 100644 --- a/uip/picksbr.c +++ b/uip/picksbr.c @@ -950,7 +950,6 @@ plist int bufsz = sizeof buf; switch (state = m_getfld (state, name, buf, &bufsz, fp)) { case FLD: - case FLDEOF: case FLDPLUS: if (bp != NULL) free (bp), bp = NULL; @@ -962,11 +961,9 @@ plist } if (!mh_strcasecmp (name, n->n_datef)) break; - if (state != FLDEOF) - continue; + continue; case BODY: - case BODYEOF: case FILEEOF: case LENERR: case FMTERR: diff --git a/uip/post.c b/uip/post.c index c81f0fcc..10ebd2ac 100644 --- a/uip/post.c +++ b/uip/post.c @@ -582,7 +582,6 @@ main (int argc, char **argv) int bufsz = sizeof buf; switch (state = m_getfld (state, name, buf, &bufsz, in)) { case FLD: - case FLDEOF: case FLDPLUS: compnum++; cp = add (buf, NULL); @@ -593,13 +592,9 @@ main (int argc, char **argv) } putfmt (name, cp, out); free (cp); - if (state != FLDEOF) - continue; - finish_headers (out); - break; + continue; case BODY: - case BODYEOF: finish_headers (out); if (whomsw) break; diff --git a/uip/prompter.c b/uip/prompter.c index 6b540dbc..a62f415e 100644 --- a/uip/prompter.c +++ b/uip/prompter.c @@ -212,7 +212,6 @@ main (int argc, char **argv) int fieldsz = sizeof field; switch (state = m_getfld (state, name, field, &fieldsz, in)) { case FLD: - case FLDEOF: case FLDPLUS: /* * Check if the value of field contains anything @@ -258,17 +257,9 @@ abort: } } - if (state == FLDEOF) { /* moby hack */ - fprintf (out, "--------\n"); - printf ("--------\n"); - if (!body) - break; - goto no_body; - } continue; case BODY: - case BODYEOF: case FILEEOF: if (!body) break; @@ -301,7 +292,7 @@ abort: else printf ("\n--------Enter additional text\n\n"); } -no_body: + fflush (stdout); for (;;) { getln (field, sizeof(field)); diff --git a/uip/sendsbr.c b/uip/sendsbr.c index a7dc0ea5..125bc027 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -607,7 +607,6 @@ splitmsg (char **vec, int vecp, char *drft, struct stat *st, int delay) switch (state = m_getfld (state, name, buffer, &bufsz, in)) { case FLD: case FLDPLUS: - case FLDEOF: compnum++; /* @@ -658,14 +657,10 @@ splitmsg (char **vec, int vecp, char *drft, struct stat *st, int delay) } } - if (state != FLDEOF) { - start = ftell (in) + 1; - continue; - } - /* else fall... */ + start = ftell (in) + 1; + continue; case BODY: - case BODYEOF: case FILEEOF: break; diff --git a/uip/show.c b/uip/show.c index ad750462..dade251c 100644 --- a/uip/show.c +++ b/uip/show.c @@ -357,7 +357,6 @@ is_nontext (char *msgnam) switch (state = m_getfld (state, name, buf, &bufsz, fp)) { case FLD: case FLDPLUS: - case FLDEOF: /* * Check Content-Type field */ diff --git a/uip/slocal.c b/uip/slocal.c index 5eadea45..a665d0ad 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -743,7 +743,6 @@ parse (int fd) int fieldsz = sizeof field; switch (state = m_getfld (state, name, field, &fieldsz, in)) { case FLD: - case FLDEOF: case FLDPLUS: lp = add (field, NULL); while (state == FLDPLUS) { @@ -777,12 +776,9 @@ parse (int fd) p++, i++; p->p_name = NULL; } - if (state != FLDEOF) - continue; - break; + continue; case BODY: - case BODYEOF: case FILEEOF: break; @@ -1431,7 +1427,6 @@ suppress_duplicates (int fd, char *file) switch (state) { case FLD: case FLDPLUS: - case FLDEOF: /* Search for the message ID */ if (mh_strcasecmp (name, "Message-ID")) { while (state == FLDPLUS) { @@ -1492,7 +1487,6 @@ suppress_duplicates (int fd, char *file) break; case BODY: - case BODYEOF: case FILEEOF: break; diff --git a/uip/sortm.c b/uip/sortm.c index 95c76b5f..b4e6d56e 100644 --- a/uip/sortm.c +++ b/uip/sortm.c @@ -374,7 +374,6 @@ get_fields (char *datesw, int msg, struct smsg *smsg) int bufsz = sizeof buf; switch (state = m_getfld (state, nam, buf, &bufsz, in)) { case FLD: - case FLDEOF: case FLDPLUS: compnum++; if (!mh_strcasecmp (nam, datesw)) { @@ -405,7 +404,6 @@ get_fields (char *datesw, int msg, struct smsg *smsg) continue; case BODY: - case BODYEOF: case FILEEOF: break; diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index a56446f8..66cf41ff 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -946,7 +946,6 @@ check_draft (char *msgnam) switch (state = m_getfld (state, name, buf, &bufsz, fp)) { case FLD: case FLDPLUS: - case FLDEOF: /* * If draft already contains any of the * Content-XXX fields, then assume it already