X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/9514ca81bd12a47df977822efc14ff285bd5bc10..5977791e005446f4cd8b2f04bfb14c8cd265df8a:/uip/mhstoresbr.c diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index d5917211..46574a13 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -10,9 +10,14 @@ #include #include #include +#include #include #include #include +#include "mhmisc.h" +#include "mhshowsbr.h" +#include "../sbr/m_maildir.h" +#include "../sbr/m_mktemp.h" enum clobber_policy_t { NMH_CLOBBER_ALWAYS = 0, @@ -22,7 +27,7 @@ enum clobber_policy_t { NMH_CLOBBER_NEVER }; -static enum clobber_policy_t clobber_policy (const char *); +static enum clobber_policy_t clobber_policy (const char *) PURE; struct mhstoreinfo { CT *cts; /* Top-level list of contents to store. */ @@ -76,11 +81,6 @@ mhstoreinfo_files_not_clobbered (const mhstoreinfo_t info) { typedef int (*qsort_comp) (const void *, const void *); -/* mhmisc.c */ -int part_ok (CT); -int type_ok (CT, int); -void flush_errors (void); - /* * static prototypes */ @@ -364,20 +364,21 @@ store_partial (CT ct, mhstoreinfo_t info) for (ctq = base; *ctq; ctq++) { p = *ctq; pm = (struct partial *) p->c_ctparams; - if (pm->pm_marked != cur) { - if (pm->pm_marked == cur - 1) { - inform("duplicate part %d of %d part multipart message, continuing...", - pm->pm_marked, hi); - continue; - } + if (pm->pm_marked == cur) { + cur++; + continue; + } + + if (pm->pm_marked == cur - 1) { + inform("duplicate part %d of %d part multipart message, continuing...", + pm->pm_marked, hi); + continue; + } missing_part: - inform("missing %spart %d of %d part multipart message", - cur != hi ? "(at least) " : "", cur, hi); - goto losing; - } - else - cur++; + inform("missing %spart %d of %d part multipart message", + cur != hi ? "(at least) " : "", cur, hi); + goto losing; } if (hi != --cur) { cur = hi; @@ -526,7 +527,7 @@ store_content (CT ct, CT p, mhstoreinfo_t info) if (p) { appending = 1; if (! ct->c_storage) { - ct->c_storage = add (p->c_storage, NULL); + ct->c_storage = mh_xstrdup(FENDNULL(p->c_storage)); /* record the folder name */ if (p->c_folder) { @@ -946,7 +947,9 @@ parse_format_string (CT ct, char *cp, char *buffer, int buflen, char *dir) * appropriate directory. */ if (*cp != '/' && *cp != '|' && *cp != '!') { - snprintf (bp, buflen, "%s/", dir[1] ? dir : ""); + if (!strcmp(dir, "/")) + dir = ""; /* Don't start with "//". */ + snprintf (bp, buflen, "%s/", dir); len = strlen (bp); bp += len; buflen -= len; @@ -967,7 +970,8 @@ parse_format_string (CT ct, char *cp, char *buffer, int buflen, char *dir) *bp = '\0'; buflen--; continue; - } else { + } + { PM pm; char *s = "";