X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/177f020f122827214159c46dcfe7ded1e3c8d1c3..6fd1d18f:/uip/ali.c?ds=sidebyside diff --git a/uip/ali.c b/uip/ali.c index fe57ef3e..a1b642cb 100644 --- a/uip/ali.c +++ b/uip/ali.c @@ -9,6 +9,7 @@ #include #include #include +#include "h/done.h" #include #define ALI_SWITCHES \ @@ -36,15 +37,15 @@ extern struct aka *akahead; /* * prototypes */ -static void print_aka (char *, int, int); -static void print_usr (char *, int); +static void print_aka (char *, bool, int); +static void print_usr (char *, bool); int main (int argc, char **argv) { - int i, vecp = 0, inverted = 0, list = 0; - int noalias = 0; + int i, vecp = 0; + bool inverted, list, noalias; char *cp, **ap, **argp, buf[BUFSIZ]; /* Really only need to allocate for argc-1, but must allocate at least 1, so go ahead and allocate for argc char pointers. */ @@ -57,6 +58,7 @@ main (int argc, char **argv) arguments = getarguments (invo_name, argc, argv, 1); argp = arguments; + inverted = list = noalias = false; while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { @@ -82,21 +84,21 @@ main (int argc, char **argv) adios (NULL, "aliasing error in %s - %s", cp, akerror (i)); continue; case NALIASW: - noalias++; + noalias = true; continue; case LISTSW: - list++; + list = true; continue; case NLISTSW: - list = 0; + list = false; continue; case USERSW: - inverted++; + inverted = true; continue; case NUSERSW: - inverted = 0; + inverted = false; continue; } } @@ -118,7 +120,7 @@ main (int argc, char **argv) for (ap = brkstring(dp = mh_xstrdup(cp), " ", "\n"); ap && *ap; ap++) if ((i = alias (*ap)) != AK_OK) adios (NULL, "aliasing error in %s - %s", *ap, akerror (i)); - mh_xfree(dp); + free(dp); } alias (AliasFile); } @@ -158,7 +160,7 @@ main (int argc, char **argv) } static void -print_aka (char *p, int list, int margin) +print_aka (char *p, bool list, int margin) { char c; @@ -198,7 +200,7 @@ print_aka (char *p, int list, int margin) } static void -print_usr (char *s, int list) +print_usr (char *s, bool list) { char *cp, *pp, *vp; struct aka *ak; @@ -217,10 +219,10 @@ print_usr (char *s, int list) while ((cp = getname (pp))) { if ((np = getm (cp, NULL, 0, NULL, 0)) == NULL) continue; - if (!strcasecmp (mp->m_host ? mp->m_host : "", - np->m_host ? np->m_host : "") && - !strcasecmp (mp->m_mbox ? mp->m_mbox : "", - np->m_mbox ? np->m_mbox : "")) { + if (!strcasecmp (FENDNULL(mp->m_host), + FENDNULL(np->m_host)) && + !strcasecmp (FENDNULL(mp->m_mbox), + FENDNULL(np->m_mbox))) { vp = vp ? add (ak->ak_name, add (",", vp)) : getcpy (ak->ak_name); mnfree (np); @@ -235,5 +237,5 @@ print_usr (char *s, int list) print_aka (vp ? vp : s, list, 0); - mh_xfree(vp); + free(vp); }