From: Ralph Corderoy Date: Mon, 21 Aug 2017 13:44:19 +0000 (+0100) Subject: Convert some Boolean variables to the bool type. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/70637f3fad9cb3cbc6f4bd8d89a32bc474fc38ad?hp=dc0fb68d25efd03d4536dd3c112d609f8be79ac1 Convert some Boolean variables to the bool type. --- diff --git a/h/aliasbr.h b/h/aliasbr.h index d1927b35..da027f59 100644 --- a/h/aliasbr.h +++ b/h/aliasbr.h @@ -8,7 +8,7 @@ struct aka { char *ak_name; /* name to match against */ struct adr *ak_addr; /* list of addresses that it maps to */ struct aka *ak_next; /* next aka in list */ - char ak_visible; /* should be visible in headers */ + bool ak_visible; /* should be visible in headers */ }; struct adr { diff --git a/h/prototypes.h b/h/prototypes.h index 7cce0ba7..2a1132c7 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -370,7 +370,7 @@ char *SystemName(void); /* * prototypes for some routines in uip */ -int annotate (char *, char *, char *, int, int, int, int); +int annotate (char *, char *, char *, bool, bool, int, bool); void annolist(char *, char *, char *, int); void annopreserve(int); void m_pclose(void); diff --git a/uip/aliasbr.c b/uip/aliasbr.c index 489b707b..7266c831 100644 --- a/uip/aliasbr.c +++ b/uip/aliasbr.c @@ -27,7 +27,7 @@ char *akvalue (char *); char *akerror (int); static char *akval (struct aka *, char *); -static int aleq (char *, char *); +static bool aleq (char *, char *); static char *scanp (char *); static char *getp (char *); static char *seekp (char *, char *, char **); @@ -147,16 +147,16 @@ akval (struct aka *ak, char *s) } -static int +static bool aleq (char *string, char *aliasent) { char c; while ((c = *string++)) { if (*aliasent == '*') - return 1; + return true; if (tolower((unsigned char)c) != tolower((unsigned char)*aliasent)) - return 0; + return false; aliasent++; } @@ -213,11 +213,11 @@ alias (char *file) } switch (lc) { case ':': - ak->ak_visible = 0; + ak->ak_visible = false; break; case ';': - ak->ak_visible = 1; + ak->ak_visible = true; break; default: @@ -402,7 +402,7 @@ akalloc (char *id) NEW(p); p->ak_name = getcpy (id); - p->ak_visible = 0; + p->ak_visible = false; p->ak_addr = NULL; p->ak_next = NULL; if (akatail != NULL) diff --git a/uip/anno.c b/uip/anno.c index 145cc97c..ef115dc2 100644 --- a/uip/anno.c +++ b/uip/anno.c @@ -79,18 +79,18 @@ static void make_comp (char **); int main (int argc, char **argv) { - int inplace = 1, datesw = 1; + bool inplace, datesw; int msgnum; char *cp, *maildir; char *comp = NULL, *text = NULL, *folder = NULL, buf[BUFSIZ]; char **argp, **arguments; struct msgs_array msgs = { 0, 0, NULL }; struct msgs *mp; - int append = 0; /* append annotations instead of default prepend */ + bool append; /* append annotations instead of default prepend */ int delete = -2; /* delete header element if set */ char *draft = NULL; /* draft file name */ int isdf = 0; /* return needed for m_draft() */ - int list = 0; /* list header elements if set */ + bool list; /* list header elements if set */ int number = 0; /* delete specific number of like elements if set */ if (nmh_init(argv[0], 1)) { return 1; } @@ -98,6 +98,8 @@ main (int argc, char **argv) arguments = getarguments (invo_name, argc, argv, 1); argp = arguments; + append = list = false; + inplace = datesw = true; while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { @@ -124,17 +126,17 @@ main (int argc, char **argv) continue; case DATESW: - datesw++; + datesw = true; continue; case NDATESW: - datesw = 0; + datesw = false; continue; case INPLSW: - inplace++; + inplace = true; continue; case NINPLSW: - inplace = 0; + inplace = false; continue; case TEXTSW: @@ -153,7 +155,7 @@ main (int argc, char **argv) continue; case LISTSW: /* produce a listing */ - list = 1; + list = true; continue; case NUMBERSW: /* number listing or delete by number */ @@ -177,7 +179,7 @@ main (int argc, char **argv) continue; case APPENDSW: /* append annotations instead of default prepend */ - append = 1; + append = true; continue; case PRESERVESW: /* preserve access and modification times on annotated message */ diff --git a/uip/annosbr.c b/uip/annosbr.c index cf5ea55a..124c77e7 100644 --- a/uip/annosbr.c +++ b/uip/annosbr.c @@ -17,7 +17,7 @@ /* * static prototypes */ -static int annosbr (int, char *, char *, char *, int, int, int, int); +static int annosbr (int, char *, char *, char *, bool, bool, int, bool); /* * This "local" global and the annopreserve() function are a hack that allows additional @@ -27,7 +27,7 @@ static int annosbr (int, char *, char *, char *, int, int, int, int); static int preserve_actime_and_modtime = 0; /* set to preserve access and modification times on annotated message */ int -annotate (char *file, char *comp, char *text, int inplace, int datesw, int delete, int append) +annotate (char *file, char *comp, char *text, bool inplace, bool datesw, int delete, bool append) { int i, fd; struct utimbuf b; @@ -168,7 +168,7 @@ annopreserve(int preserve) } static int -annosbr (int fd, char *file, char *comp, char *text, int inplace, int datesw, int delete, int append) +annosbr (int fd, char *file, char *comp, char *text, bool inplace, bool datesw, int delete, bool append) { int mode, tmpfd; char *cp, *sp; @@ -199,7 +199,7 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace, int datesw, in * as they're read in. This buffer is grown as needed later. */ - if (delete >= -1 || append != 0) { + if (delete >= -1 || append) { if ((fp = fdopen(fd, "r")) == NULL) adios(NULL, "unable to fdopen file.");