]> diplodocus.org Git - nmh/blobdiff - uip/slocal.c
fdcompare.c: Move interface to own file.
[nmh] / uip / slocal.c
index 98c1af163f1d6aa5d23b6bc4de26c37fbcb72578..9f784f8dac5144592195412a2023841cdd4da001 100644 (file)
  * Ruud de Rooij <ruud@ruud.org>  Sun, 28 May 2000 17:28:55 +0200
  */
 
-#include <h/mh.h>
-#include <h/dropsbr.h>
-#include <h/rcvmail.h>
-#include <h/signals.h>
+#include "h/mh.h"
+#include "sbr/ambigsw.h"
+#include "sbr/pidstatus.h"
+#include "sbr/print_version.h"
+#include "sbr/print_help.h"
+#include "sbr/error.h"
+#include "h/dropsbr.h"
+#include "h/rcvmail.h"
+#include "h/signals.h"
 #include <setjmp.h>
-#include <h/tws.h>
-#include <h/mts.h>
+#include "h/tws.h"
+#include "h/mts.h"
 #include "h/done.h"
-#include <h/utils.h>
+#include "h/utils.h"
 #include "sbr/lock_file.h"
 #include "sbr/m_mktemp.h"
 
@@ -83,10 +88,10 @@ DEFINE_SWITCH_ARRAY(SLOCAL, switches);
 static int globbed = 0;                /* have we built "vars" table yet?        */
 static int parsed = 0;         /* have we built header field table yet   */
 static int utmped = 0;         /* have we scanned umtp(x) file yet       */
-static int suppressdup = 0;    /* are we suppressing duplicate messages? */
+static bool suppressdup;       /* are we suppressing duplicate messages? */
 
-static int verbose = 0;
-static int debug = 0;
+static bool verbose;
+static bool debug;
 
 static char *addr = NULL;
 static char *user = NULL;
@@ -251,20 +256,20 @@ main (int argc, char **argv)
                    continue;
 
                case VERBSW: 
-                   verbose++;
+                   verbose = true;
                    continue;
                case NVERBSW: 
-                   verbose = 0;
+                   verbose = false;
                    continue;
 
                case SUPPRESSDUP:
-                   suppressdup++;
+                   suppressdup = true;
                    continue;
                case NSUPPRESSDUP:
-                   suppressdup = 0;
+                   suppressdup = false;
                    continue;
                case DEBUGSW: 
-                   debug++;
+                   debug = true;
                    continue;
            }
        } else {
@@ -421,7 +426,12 @@ localmail (int fd, char *mdlvr)
 static int
 usr_delivery (int fd, char *delivery, int su)
 {
-    int i, accept, status=1, won, vecp, next;
+    int i;
+    bool accept;
+    int status=1;
+    bool won;
+    int vecp;
+    bool next;
     char *field, *pattern, *action, *result, *string;
     char buffer[BUFSIZ], tmpbuf[BUFSIZ];
     char *vec[NVEC];
@@ -444,8 +454,8 @@ usr_delivery (int fd, char *delivery, int su)
        return -1;
     }
 
-    won = 0;
-    next = 1;
+    won = false;
+    next = true;
 
     /* read and process delivery file */
     while (fgets (buffer, sizeof(buffer), fp)) {
@@ -503,7 +513,7 @@ usr_delivery (int fd, char *delivery, int su)
                 * Take action, and consider delivered if
                 * action is successful.
                 */
-               accept = 1;
+               accept = true;
                break;
 
            case 'R': 
@@ -513,7 +523,7 @@ usr_delivery (int fd, char *delivery, int su)
                 * Take action, but don't consider delivered, even
                 * if action is successful
                 */
-               accept = 0;
+               accept = false;
                break;
        }
 
@@ -556,9 +566,9 @@ usr_delivery (int fd, char *delivery, int su)
                 */
                if ((p = lookup (hdrs, field)) && (p->p_value != NULL)
                        && matches (p->p_value, pattern)) {
-                   next = 1;
+                   next = true;
                } else {
-                   next = 0;
+                   next = false;
                    continue;
                }
                break;
@@ -630,10 +640,10 @@ usr_delivery (int fd, char *delivery, int su)
                break;
        }
 
-       if (status) next = 0;   /* action failed, mark for 'N' result */
+       if (status) next = false; /* action failed, mark for 'N' result */
 
        if (accept && status == 0)
-           won++;
+           won = true;
     }
 
     fclose (fp);