]> diplodocus.org Git - nmh/blobdiff - uip/replsbr.c
Replaced hard-coded value with MAX_DELIMITER_SIZE in m_getfld.c.
[nmh] / uip / replsbr.c
index dc3c4f8..c0ffb72 100644 (file)
@@ -72,6 +72,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
     char name[NAMESZ], *scanl;
     unsigned char *cp;
     static int dat[5];                 /* aux. data for format routine */
+    m_getfld_state_t gstate;
 
     FILE *out;
     NMH_UNUSED (msg);
@@ -131,9 +132,10 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
     /*
      * pick any interesting stuff out of msg "inb"
      */
-    for (state = FLD;;) {
+    m_getfld_state_init (&gstate);
+    for (;;) {
        int msg_count = sizeof tmpbuf;
-       state = m_getfld (state, name, tmpbuf, &msg_count, inb);
+       state = m_getfld (gstate, name, tmpbuf, &msg_count, inb);
        switch (state) {
            case FLD: 
            case FLDPLUS: 
@@ -149,7 +151,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
                    char_read += msg_count;
                    while (state == FLDPLUS) {
                        msg_count= sizeof tmpbuf;
-                       state = m_getfld(state, name, tmpbuf, &msg_count, inb);
+                       state = m_getfld (gstate, name, tmpbuf, &msg_count, inb);
                        fmt_appendcomp(i, name, tmpbuf);
                        char_read += msg_count;
                    }
@@ -157,7 +159,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
 
                while (state == FLDPLUS) {
                    msg_count= sizeof tmpbuf;
-                   state = m_getfld (state, name, tmpbuf, &msg_count, inb);
+                   state = m_getfld (gstate, name, tmpbuf, &msg_count, inb);
                }
                break;
 
@@ -171,6 +173,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
                adios (NULL, "m_getfld() returned %d", state);
        }
     }
+    m_getfld_state_destroy (&gstate);
 
     /*
      * format and output the header lines.