X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/dbdbd49d59ae5c14e66b1c148a63b8abc9d076ab..28ebf6bb835e9954c0f959b56c8abac2bf3decd5:/uip/slocal.c diff --git a/uip/slocal.c b/uip/slocal.c index 98c1af16..5eb5243c 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -19,15 +19,28 @@ * Ruud de Rooij Sun, 28 May 2000 17:28:55 +0200 */ -#include -#include -#include -#include +#include "h/mh.h" +#include "sbr/dtime.h" +#include "sbr/m_gmprot.h" +#include "sbr/m_getfld.h" +#include "sbr/getarguments.h" +#include "sbr/smatch.h" +#include "sbr/strindex.h" +#include "sbr/closefds.h" +#include "sbr/trimcpy.h" +#include "sbr/getcpy.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/signals.h" #include -#include -#include +#include "h/tws.h" +#include "h/mts.h" #include "h/done.h" -#include +#include "h/utils.h" #include "sbr/lock_file.h" #include "sbr/m_mktemp.h" @@ -83,10 +96,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 +264,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 { @@ -379,7 +392,7 @@ main (int argc, char **argv) /* deliver the message */ status = localmail (fd, mdlvr); - done (status != -1 ? RCV_MOK : RCV_MBX); + done(status != -1 ? 0 : 1); return 1; } @@ -421,7 +434,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 +462,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 +521,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 +531,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 +574,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 +648,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);