]> diplodocus.org Git - nmh/blobdiff - uip/whatnowsbr.c
m_getfld() now supports interleaving calls with
[nmh] / uip / whatnowsbr.c
index 389053727c45213dcdfc0c525e39c41a2a5c358f..a56446f8c6f482375ea802c9153a5b7f12bc94b4 100644 (file)
@@ -941,8 +941,9 @@ check_draft (char *msgnam)
 
     if ((fp = fopen (msgnam, "r")) == NULL)
        return 0;
-    for (state = FLD;;)
-       switch (state = m_getfld (state, name, buf, sizeof(buf), fp)) {
+    for (state = FLD;;) {
+       int bufsz = sizeof buf;
+       switch (state = m_getfld (state, name, buf, &bufsz, fp)) {
            case FLD:
            case FLDPLUS:
            case FLDEOF:
@@ -955,8 +956,10 @@ check_draft (char *msgnam)
                    fclose (fp);
                    return 0;
                }
-               while (state == FLDPLUS)
-                   state = m_getfld (state, name, buf, sizeof(buf), fp);
+               while (state == FLDPLUS) {
+                   bufsz = sizeof buf;
+                   state = m_getfld (state, name, buf, &bufsz, fp);
+               }
                break;
 
            case BODY:
@@ -969,7 +972,8 @@ check_draft (char *msgnam)
                            return 1;
                        }
 
-                   state = m_getfld (state, name, buf, sizeof(buf), fp);
+                   bufsz = sizeof buf;
+                   state = m_getfld (state, name, buf, &bufsz, fp);
                } while (state == BODY);
                /* and fall... */
 
@@ -977,6 +981,7 @@ check_draft (char *msgnam)
                fclose (fp);
                return 0;
        }
+    }
 }