]> diplodocus.org Git - nmh/blobdiff - uip/ali.c
getpass.c: Move interface to own file.
[nmh] / uip / ali.c
index 43e9f5a73aa39600aa95db7d364ef6304187d3b5..229831b954d6f9932c9be9617d69d2033e1d2c01 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -5,11 +5,19 @@
  * complete copyright information.
  */
 
-#include <h/mh.h>
-#include <h/addrsbr.h>
-#include <h/aliasbr.h>
-#include <h/mts.h>
-#include <h/utils.h>
+#include "h/mh.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 +59,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 +73,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 +86,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 +115,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 +126,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 +137,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 +184,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 +214,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;