* seq_read.c -- read the .mh_sequence file and
* -- initialize sequence information
*
- * $Id$
- *
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
+#include <h/utils.h>
/*
* static prototypes
char *cp, seqfile[PATH_MAX];
char name[NAMESZ], field[BUFSIZ];
FILE *fp;
+ m_getfld_state_t gstate = 0;
/*
* If mh_seq == NULL (such as if nmh been compiled with
return;
/* Use m_getfld to scan sequence file */
- for (state = FLD;;) {
- switch (state = m_getfld (state, name, field, sizeof(field), fp)) {
+ for (;;) {
+ int fieldsz = sizeof field;
+ switch (state = m_getfld (&gstate, name, field, &fieldsz, fp)) {
case FLD:
case FLDPLUS:
- case FLDEOF:
if (state == FLDPLUS) {
cp = getcpy (field);
while (state == FLDPLUS) {
- state = m_getfld (state, name, field, sizeof(field), fp);
+ fieldsz = sizeof field;
+ state = m_getfld (&gstate, name, field, &fieldsz, fp);
cp = add (field, cp);
}
seq_init (mp, getcpy (name), trimcpy (cp));
} else {
seq_init (mp, getcpy (name), trimcpy (field));
}
- if (state == FLDEOF)
- break;
continue;
case BODY:
- case BODYEOF:
adios (NULL, "no blank lines are permitted in %s", seqfile);
/* fall */
}
break; /* break from for loop */
}
+ m_getfld_state_destroy (&gstate);
lkfclose (fp, seqfile);
}
static int
seq_init (struct msgs *mp, char *name, char *field)
{
- int i, j, k, is_current;
+ unsigned int i;
+ int j, k, is_current;
char *cp, **ap;
/*