struct part **pp;
CT ct;
FILE *in;
+ m_getfld_state_t gstate = 0;
directive_init(directives);
* draft into the linked list of header fields for
* the new MIME message.
*/
- for (compnum = 1, state = FLD;;) {
- switch (state = m_getfld (state, name, buf, sizeof(buf), in)) {
+ m_getfld_track_filepos (&gstate, in);
+ for (compnum = 1;;) {
+ int bufsz = sizeof buf;
+ switch (state = m_getfld (&gstate, name, buf, &bufsz, in)) {
case FLD:
case FLDPLUS:
- case FLDEOF:
compnum++;
/* abort if draft has Mime-Version header field */
/* ignore any Content-Type fields in the header */
if (!mh_strcasecmp (name, TYPE_FIELD)) {
- while (state == FLDPLUS)
- state = m_getfld (state, name, buf, sizeof(buf), in);
+ while (state == FLDPLUS) {
+ bufsz = sizeof buf;
+ state = m_getfld (&gstate, name, buf, &bufsz, in);
+ }
goto finish_field;
}
/* if necessary, get rest of field */
while (state == FLDPLUS) {
- state = m_getfld (state, name, buf, sizeof(buf), in);
+ bufsz = sizeof buf;
+ state = m_getfld (&gstate, name, buf, &bufsz, in);
vp = add (buf, vp); /* add to previous value */
}
finish_field:
/* if this wasn't the last header field, then continue */
- if (state != FLDEOF)
- continue;
- /* else fall... */
+ continue;
case FILEEOF:
adios (NULL, "draft has empty body -- no directives!");
/* NOTREACHED */
case BODY:
- case BODYEOF:
fseek (in, (long) (-strlen (buf)), SEEK_CUR);
break;
}
break;
}
+ m_getfld_state_destroy (&gstate);
/*
* Now add the MIME-Version header field
if ((out = fopen (ce->ce_file, "w")) == NULL)
adios (ce->ce_file, "unable to open for writing");
- for (i = 0; (child_id = vfork()) == NOTOK && i > 5; i++)
+ for (i = 0; (child_id = fork()) == NOTOK && i > 5; i++)
sleep (5);
switch (child_id) {
case NOTOK: