-
- /*
- * Finish up with the file name.
- */
-
- (void)fprintf(composition_file, " %s\n", file_name);
-
- return;
-}
-
-/*
- * 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 (!mh_strcasecmp (name, "Message-ID")) {
- while (state == FLDPLUS)
- state = m_getfld (state, name, buffer, sizeof(buffer), in);
- } else if (uprf (name, XXX_FIELD_PRF)
- || !mh_strcasecmp (name, VRSN_FIELD)
- || !mh_strcasecmp (name, "Subject")
- || !mh_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 (!mh_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);
- }
- }
-
- if (state != FLDEOF) {
- start = ftell (in) + 1;
- continue;
- }
- /* else fall... */
-
- case BODY:
- case BODYEOF:
- case FILEEOF:
- break;
-
- case LENERR:
- case FMTERR:
- adios (NULL, "message format error in component #%d", compnum);
-
- default:
- adios (NULL, "getfld () returned %d", state);
- }
-
- break;