X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/dc0fb68d25efd03d4536dd3c112d609f8be79ac1..04ee0c3f6ad7e4177cc43a0c57f046013a4fbac9:/uip/ali.c diff --git a/uip/ali.c b/uip/ali.c index 1c75644b..9853d668 100644 --- a/uip/ali.c +++ b/uip/ali.c @@ -5,11 +5,15 @@ * complete copyright information. */ -#include -#include -#include -#include -#include +#include "h/mh.h" +#include "sbr/print_version.h" +#include "sbr/print_help.h" +#include "sbr/error.h" +#include "h/addrsbr.h" +#include "h/aliasbr.h" +#include "h/mts.h" +#include "h/done.h" +#include "h/utils.h" #define ALI_SWITCHES \ X("alias aliasfile", 0, ALIASW) \ @@ -51,7 +55,7 @@ main (int argc, char **argv) char **vec = mh_xmalloc (argc * sizeof (char *)), **arguments; struct aka *ak; - if (nmh_init(argv[0], 1)) { return 1; } + if (nmh_init(argv[0], true, true)) { return 1; } mts_init (); arguments = getarguments (invo_name, argc, argv, 1); @@ -65,7 +69,7 @@ main (int argc, char **argv) ambigsw (cp, switches); done (1); case UNKWNSW: - adios (NULL, "-%s unknown", cp); + die("-%s unknown", cp); case HELPSW: snprintf (buf, sizeof(buf), "%s [switches] aliases ...", @@ -78,9 +82,9 @@ main (int argc, char **argv) case ALIASW: if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); + die("missing argument to %s", argp[-2]); if ((i = alias (cp)) != AK_OK) - adios (NULL, "aliasing error in %s - %s", cp, akerror (i)); + die("aliasing error in %s - %s", cp, akerror (i)); continue; case NALIASW: noalias = true; @@ -107,7 +111,7 @@ main (int argc, char **argv) } else { /* Should never happen, but try to protect against code changes that could allow it. */ - adios (NULL, "too many arguments"); + die("too many arguments"); } } @@ -118,8 +122,8 @@ 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); + die("aliasing error in %s - %s", *ap, akerror (i)); + free(dp); } alias (AliasFile); } @@ -129,7 +133,7 @@ main (int argc, char **argv) */ if (inverted) { if (vecp == 0) - adios (NULL, "usage: %s -user addresses ... (you forgot the addresses)", + die("usage: %s -user addresses ... (you forgot the addresses)", invo_name); for (i = 0; i < vecp; i++) @@ -176,10 +180,10 @@ print_aka (char *p, bool list, int margin) printf ("\n%*s", margin, ""); else { if (pos >= 68) { - printf (",\n "); + fputs(",\n ", stdout); pos = 2; } else { - printf (", "); + fputs(", ", stdout); pos += 2; } } @@ -206,9 +210,9 @@ print_usr (char *s, bool list) struct mailname *mp, *np; if ((pp = getname (s)) == NULL) - adios (NULL, "no address in \"%s\"", s); + die("no address in \"%s\"", s); if ((mp = getm (pp, NULL, 0, NULL, 0)) == NULL) - adios (NULL, "bad address \"%s\"", s); + die("bad address \"%s\"", s); while (getname ("")) continue; @@ -236,5 +240,5 @@ print_usr (char *s, bool list) print_aka (vp ? vp : s, list, 0); - mh_xfree(vp); + free(vp); }