]> diplodocus.org Git - nmh/blobdiff - uip/picksbr.c
m_backup.c: Move interface to own file.
[nmh] / uip / picksbr.c
index 2eddab7f1262910f2ad30e14d30c61b3e9d14358..346dcc7031063426aac22b27420d854659ffd874 100644 (file)
@@ -5,10 +5,13 @@
  * complete copyright information.
  */
 
-#include <h/mh.h>
-#include <h/tws.h>
-#include <h/picksbr.h>
-#include <h/utils.h>
+#include "h/mh.h"
+#include "sbr/brkstring.h"
+#include "sbr/ambigsw.h"
+#include "sbr/error.h"
+#include "h/tws.h"
+#include "h/picksbr.h"
+#include "h/utils.h"
 
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
@@ -644,21 +647,23 @@ cerror: ;
 static int
 GREPaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
 {
-    int c, body, lf;
+    int c;
+    bool body;
+    bool lf;
     long pos = start;
     char *p1, *p2, *ebp, *cbp;
     char ibuf[BUFSIZ];
     NMH_UNUSED (msgnum);
 
     fseek (fp, start, SEEK_SET);
-    body = 0;
+    body = false;
     ebp = cbp = ibuf;
     for (;;) {
        if (body && n->n_header)
            return 0;
        p1 = linebuf;
        p2 = cbp;
-       lf = 0;
+       lf = false;
        for (;;) {
            if (p2 >= ebp) {
                if (fgets (ibuf, sizeof ibuf, fp) == NULL
@@ -677,16 +682,16 @@ GREPaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
                    --p2;
                    break;
                }
-                lf = 0;
+                lf = false;
            }
            if (c == '\n') {
                if (body)
                    break;
                 if (lf) {
-                    body++;
+                    body = true;
                     break;
                 }
-                lf++;
+                lf = true;
                 /* Unfold by skipping the newline. */
                 c = 0;
            }
@@ -701,7 +706,7 @@ GREPaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
 
        /* Attempt to decode as a MIME header.  If it's the last header,
           body will be 1 and lf will be at least 1. */
-       if ((body == 0 || lf > 0)  &&
+       if ((!body || lf)  &&
            decode_rfc2047 (linebuf, decoded_linebuf, sizeof decoded_linebuf)) {
            p1 = decoded_linebuf;
        }
@@ -958,7 +963,7 @@ TWSaction(struct nexus *n, FILE *fp, int msgnum, long start, long stop)
                return 0;
 
            default: 
-               adios (NULL, "internal error -- you lose");
+               die("internal error -- you lose");
        }
        break;
     }