-/*
- * Split large message into several messages of
- * type "message/partial" and send them.
- */
-
-static int
-splitmsg (char **vec, int vecp, char *drft, struct stat *st, int delay)
-{
- int compnum, nparts, partno, state, status;
- long pos, start;
- time_t clock;
- char *cp, *dp, buffer[BUFSIZ], msgid[BUFSIZ];
- char subject[BUFSIZ];
- char name[NAMESZ], partnum[BUFSIZ];
- FILE *in;
-
- if ((in = fopen (drft, "r")) == NULL)
- adios (drft, "unable to open for reading");
-
- cp = dp = NULL;
- start = 0L;
-
- /*
- * Scan through the message and examine the various header fields,
- * as well as locate the beginning of the message body.
- */
- for (compnum = 1, state = FLD;;) {
- switch (state = m_getfld (state, name, buffer, sizeof(buffer), in)) {
- case FLD:
- case FLDPLUS:
- case FLDEOF:
- compnum++;
-
- /*
- * This header field is discarded.
- */
- if (!strcasecmp (name, "Message-ID")) {
- while (state == FLDPLUS)
- state = m_getfld (state, name, buffer, sizeof(buffer), in);
- } else if (uprf (name, XXX_FIELD_PRF)
- || !strcasecmp (name, VRSN_FIELD)
- || !strcasecmp (name, "Subject")
- || !strcasecmp (name, "Encrypted")) {
- /*
- * These header fields are copied to the enclosed
- * header of the first message in the collection
- * of message/partials. For the "Subject" header
- * field, we also record it, so that a modified
- * version of it, can be copied to the header
- * of each messsage/partial in the collection.
- */
- if (!strcasecmp (name, "Subject")) {
- size_t sublen;
-
- strncpy (subject, buffer, BUFSIZ);
- sublen = strlen (subject);
- if (sublen > 0 && subject[sublen - 1] == '\n')
- subject[sublen - 1] = '\0';
- }
-
- dp = add (concat (name, ":", buffer, NULL), dp);
- while (state == FLDPLUS) {
- state = m_getfld (state, name, buffer, sizeof(buffer), in);
- dp = add (buffer, dp);
- }
- } else {
- /*
- * These header fields are copied to the header of
- * each message/partial in the collection.
- */
- cp = add (concat (name, ":", buffer, NULL), cp);
- while (state == FLDPLUS) {
- state = m_getfld (state, name, buffer, sizeof(buffer), in);
- cp = add (buffer, cp);
- }
+ /*
+ ** Check the file name for a suffix. Scan the context for that
+ ** suffix on a mhshow-suffix- entry. We use these entries to
+ ** be compatible with mhshow, and there's no reason to make the
+ ** user specify each suffix twice. Context entries of the form
+ ** "mhshow-suffix-contenttype" in the name have the suffix in
+ ** the field, including the dot.
+ */
+
+ if ((p = strrchr(file_name, '.')) != (char *)0) {
+ for (np = m_defs; np; np = np->n_next) {
+ if (strncasecmp(np->n_name, "mhshow-suffix-", 14) == 0
+ && mh_strcasecmp(p, np->n_field) == 0)
+ {
+ content_type = np->n_name + 14;
+ break;
+ }