- args = (char **) mh_xmalloc((i + 2) * sizeof(char *));
-
- /*
- ** For backward compatibility, we need to add -build
- ** if we are using mhn as buildmimeproc
- */
- i = 0;
- if (strcmp(r1bindex(ed, '/'), "mhn") == 0)
- args[i++] = "-build";
-
- /* copy any other arguments */
- while (argp && *argp)
- args[i++] = *argp++;
- args[i] = NULL;
-
- i = editfile(&ed, args, file, NOUSE, NULL, NULL, NULL, 0);
- free(args);
-
- return (i ? NOTOK : OK);
-}
-
-
-/*
-** Check if draft is a mhbuild composition file
-*/
-
-static int
-check_draft(char *msgnam)
-{
- int state;
- char buf[BUFSIZ], name[NAMESZ];
- FILE *fp;
-
- if ((fp = fopen(msgnam, "r")) == NULL)
- return 0;
- for (state = FLD;;)
- switch (state = m_getfld(state, name, buf, sizeof(buf), fp)) {
- case FLD:
- case FLDPLUS:
- case FLDEOF:
- /*
- ** If draft already contains any of the
- ** Content-XXX fields, then assume it already
- ** been converted.
- */
- if (uprf(name, XXX_FIELD_PRF)) {
- fclose(fp);
- return 0;
- }
- while (state == FLDPLUS)
- state = m_getfld(state, name, buf,
- sizeof(buf), fp);
- break;
-
- case BODY:
- do {
- char *bp;
-
- for (bp = buf; *bp; bp++)
- if (*bp != ' ' && *bp != '\t' && *bp != '\n') {
- fclose(fp);
- return 1;
- }
-
- state = m_getfld(state, name, buf,
- sizeof(buf), fp);
- } while (state == BODY);
- /* and fall... */
-
- default:
- fclose(fp);
- return 0;
- }