X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/de4636bb664106d9932ae7acb517e471b848f1f3..df6e7ebd567b8c815843682a2739009bac298b33:/uip/mshcmds.c diff --git a/uip/mshcmds.c b/uip/mshcmds.c index 8212375a..6ea1126c 100644 --- a/uip/mshcmds.c +++ b/uip/mshcmds.c @@ -51,6 +51,8 @@ static int process (int, char *, int, char **); static void copy_message (int, FILE *); static void copy_digest (int, FILE *); +extern m_getfld_state_t gstate; /* use the gstate in scansbr.c */ + void forkcmd (char **args, char *pgm) { @@ -950,7 +952,7 @@ forw (char *proc, char *filter, int vecp, char **vec) args[i++] = getcpy (m_name (msgnum)); args[i] = NULL; mhlsbr (i, args, mhl_action); - m_eomsbr ((int (*) ()) 0); + scan_eom_action ((int (*) ()) 0); fclose (stdout); _exit (0); @@ -2211,7 +2213,7 @@ finish: ; if (mp->numsel == 1 && headersw) show (mp->lowsel); mhlsbr (vecp, vec, mhl_action); - m_eomsbr ((int (*)()) 0); + scan_eom_action ((int (*)()) 0); while (msgp < vecp) free (vec[msgp++]); } else { @@ -2283,7 +2285,7 @@ mhl_action (char *name) mhlfp = msh_ready (msgnum, 1); if (!fmsh) - m_eomsbr (eom_action); + scan_eom_action (eom_action); return mhlfp; } @@ -2341,11 +2343,11 @@ is_nontext (int msgnum) fp = msh_ready (msgnum, 1); - for (state = FLD;;) - switch (state = m_getfld (state, name, buf, sizeof buf, fp)) { + for (;;) { + int bufsz = sizeof buf; + switch (state = m_getfld (&gstate, name, buf, &bufsz, fp)) { case FLD: case FLDPLUS: - case FLDEOF: /* * Check Content-Type field */ @@ -2355,7 +2357,8 @@ is_nontext (int msgnum) cp = add (buf, NULL); while (state == FLDPLUS) { - state = m_getfld (state, name, buf, sizeof buf, fp); + bufsz = sizeof buf; + state = m_getfld (&gstate, name, buf, &bufsz, fp); cp = add (buf, cp); } bp = cp; @@ -2458,7 +2461,8 @@ out: if (!mh_strcasecmp (name, ENCODING_FIELD)) { cp = add (buf, NULL); while (state == FLDPLUS) { - state = m_getfld (state, name, buf, sizeof buf, fp); + bufsz = sizeof buf; + state = m_getfld (&gstate, name, buf, &bufsz, fp); cp = add (buf, cp); } for (bp = cp; isspace (*bp); bp++) @@ -2482,8 +2486,10 @@ out: * Just skip the rest of this header * field and go to next one. */ - while (state == FLDPLUS) - state = m_getfld (state, name, buf, sizeof(buf), fp); + while (state == FLDPLUS) { + bufsz = sizeof buf; + state = m_getfld (&gstate, name, buf, &bufsz, fp); + } break; /* @@ -2493,6 +2499,7 @@ out: default: return 0; } + } } @@ -2645,15 +2652,17 @@ get_fields (char *datesw, char *subjsw, int msgnum, struct Msg *msgp) register FILE *zp; zp = msh_ready (msgnum, 0); - for (state = FLD;;) { - switch (state = m_getfld (state, name, buf, sizeof buf, zp)) { + + for (;;) { + int bufsz = sizeof buf; + switch (state = m_getfld (&gstate, name, buf, &bufsz, zp)) { case FLD: - case FLDEOF: case FLDPLUS: if (!mh_strcasecmp (name, datesw)) { bp = getcpy (buf); while (state == FLDPLUS) { - state = m_getfld (state, name, buf, sizeof buf, zp); + bufsz = sizeof buf; + state = m_getfld (&gstate, name, buf, &bufsz, zp); bp = add (buf, bp); } if ((tw = dparsetime (bp)) == NULL) @@ -2670,7 +2679,8 @@ get_fields (char *datesw, char *subjsw, int msgnum, struct Msg *msgp) else if (subjsw && !mh_strcasecmp(name, subjsw)) { bp = getcpy (buf); while (state == FLDPLUS) { - state = m_getfld (state, name, buf, sizeof buf, zp); + bufsz = sizeof buf; + state = m_getfld (&gstate, name, buf, &bufsz, zp); bp = add (buf, bp); } msgp->m_scanl = sosmash(subjsw, bp); @@ -2679,13 +2689,14 @@ get_fields (char *datesw, char *subjsw, int msgnum, struct Msg *msgp) else subjsw = (char *)0;/* subject done, need date */ } else { - while (state == FLDPLUS) /* flush this one */ - state = m_getfld (state, name, buf, sizeof buf, zp); + while (state == FLDPLUS) { /* flush this one */ + bufsz = sizeof buf; + state = m_getfld (&gstate, name, buf, &bufsz, zp); + } } continue; case BODY: - case BODYEOF: case FILEEOF: break;