]> diplodocus.org Git - nmh/blobdiff - uip/replsbr.c
Added support for m_getfld() callers interleaving fseek() calls
[nmh] / uip / replsbr.c
index 3dbc3031ee614874f3a941ea45dd048321b4590c..dc3c4f8c36c5ccda1a3effd29a4a21a501effe88 100644 (file)
@@ -132,7 +132,8 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
      * pick any interesting stuff out of msg "inb"
      */
     for (state = FLD;;) {
-       state = m_getfld (state, name, tmpbuf, sizeof(tmpbuf), inb);
+       int msg_count = sizeof tmpbuf;
+       state = m_getfld (state, name, tmpbuf, &msg_count, inb);
        switch (state) {
            case FLD: 
            case FLDPLUS: 
@@ -147,15 +148,17 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
                if (i != -1) {
                    char_read += msg_count;
                    while (state == FLDPLUS) {
-                       state = m_getfld(state, name, tmpbuf,
-                                        sizeof(tmpbuf), inb);
+                       msg_count= sizeof tmpbuf;
+                       state = m_getfld(state, name, tmpbuf, &msg_count, inb);
                        fmt_appendcomp(i, name, tmpbuf);
                        char_read += msg_count;
                    }
                }
 
-               while (state == FLDPLUS)
-                   state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
+               while (state == FLDPLUS) {
+                   msg_count= sizeof tmpbuf;
+                   state = m_getfld (state, name, tmpbuf, &msg_count, inb);
+               }
                break;
 
            case LENERR: