]> diplodocus.org Git - nmh/blobdiff - uip/rcvdist.c
Make sure we created the test file even if we don't have iconv support;
[nmh] / uip / rcvdist.c
index 8f88639a9d558a1c9f0d9ead58de5fbe31942a9a..33890d5f786343bc869dc75de4d3ab2fde5ea130 100644 (file)
@@ -176,6 +176,7 @@ rcvdistout (FILE *inb, char *form, char *addrs)
     char *cp, *scanl, name[NAMESZ], tmpbuf[SBUFSIZ];
     register struct comp *cptr;
     FILE *out;
+    m_getfld_state_t gstate = 0;
 
     if (!(out = fopen (drft, "w")))
        adios (drft, "unable to create");
@@ -195,22 +196,26 @@ rcvdistout (FILE *inb, char *form, char *addrs)
     if (cptr)
        cptr->c_text = addrs;
 
-    for (state = FLD;;) {
-       switch (state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb)) {
+    for (;;) {
+       int msg_count = SBUFSIZ;
+       switch (state = m_getfld (&gstate, name, tmpbuf, &msg_count, inb)) {
            case FLD: 
            case FLDPLUS: 
                i = fmt_addcomptext(name, tmpbuf);
                if (i != -1) {
                    char_read += msg_count;
                    while (state == FLDPLUS) {
-                       state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
+                       msg_count = SBUFSIZ;
+                       state = m_getfld (&gstate, 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 = SBUFSIZ;
+                   state = m_getfld (&gstate, name, tmpbuf, &msg_count, inb);
+               }
                break;
 
            case LENERR: 
@@ -224,6 +229,7 @@ rcvdistout (FILE *inb, char *form, char *addrs)
        }
     }
 finished: ;
+    m_getfld_state_destroy (&gstate);
 
     i = format_len + char_read + 256;
     scanl = mh_xmalloc ((size_t) i + 2);