X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/92c3b05ef3e582d64b3cecfc261fdd66ef13a4ef..8ce0a681f1e9e68d0623a066fb485b7be1267028:/uip/ali.c diff --git a/uip/ali.c b/uip/ali.c index 43e9f5a7..6e94f8c1 100644 --- a/uip/ali.c +++ b/uip/ali.c @@ -5,11 +5,20 @@ * complete copyright information. */ -#include -#include -#include -#include -#include +#include "h/mh.h" +#include "sbr/smatch.h" +#include "sbr/getcpy.h" +#include "sbr/context_find.h" +#include "sbr/brkstring.h" +#include "sbr/ambigsw.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 +60,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 +74,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 +87,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 +116,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,7 +127,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)); + die("aliasing error in %s - %s", *ap, akerror (i)); free(dp); } alias (AliasFile); @@ -129,7 +138,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 +185,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 +215,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;