-void print_aka (char *, int, int);
-void print_usr (char *, int, int);
+static void print_aka (char *, int, int);
+static void print_usr (char *, int, int);
- int i, vecp = 0, inverted = 0, list = 0;
- int noalias = 0, normalize = AD_NHST;
- char *cp, **ap, **argp, buf[BUFSIZ];
- char *vec[NVEC], **arguments;
- struct aka *ak;
+ int i, vecp = 0, inverted = 0, list = 0;
+ int noalias = 0, normalize = AD_NHST;
+ char *cp, **ap, **argp, buf[BUFSIZ];
+ char *vec[NVEC], **arguments;
+ struct aka *ak;
- invo_name = r1bindex (argv[0], '/');
-
- /* read user profile/context */
- context_read();
-
- mts_init (invo_name);
- arguments = getarguments (invo_name, argc, argv, 1);
- argp = arguments;
-
- while ((cp = *argp++)) {
- if (*cp == '-') {
- switch (smatch (++cp, switches)) {
- case AMBIGSW:
- ambigsw (cp, switches);
- done (1);
- case UNKWNSW:
- adios (NULL, "-%s unknown", cp);
-
- case HELPSW:
- snprintf (buf, sizeof(buf), "%s [switches] aliases ...",
- invo_name);
- print_help (buf, switches, 1);
- done (1);
- case VERSIONSW:
- print_version (invo_name);
- done (1);
-
- case ALIASW:
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- if ((i = alias (cp)) != AK_OK)
- adios (NULL, "aliasing error in %s - %s", cp, akerror (i));
- continue;
- case NALIASW:
- noalias++;
- continue;
-
- case LISTSW:
- list++;
- continue;
- case NLISTSW:
- list = 0;
- continue;
-
- case NORMSW:
- normalize = AD_HOST;
- continue;
- case NNORMSW:
- normalize = AD_NHST;
- continue;
-
- case USERSW:
- inverted++;
- continue;
- case NUSERSW:
- inverted = 0;
- continue;
- }
+ invo_name = r1bindex (argv[0], '/');
+
+ /* read user profile/context */
+ context_read();
+
+ mts_init (invo_name);
+ arguments = getarguments (invo_name, argc, argv, 1);
+ argp = arguments;
+
+ while ((cp = *argp++)) {
+ if (*cp == '-') {
+ switch (smatch (++cp, switches)) {
+ case AMBIGSW:
+ ambigsw (cp, switches);
+ done (1);
+ case UNKWNSW:
+ adios (NULL, "-%s unknown", cp);
+
+ case HELPSW:
+ snprintf (buf, sizeof(buf), "%s [switches] aliases ...",
+ invo_name);
+ print_help (buf, switches, 1);
+ done (1);
+ case VERSIONSW:
+ print_version (invo_name);
+ done (1);
+
+ case ALIASW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ if ((i = alias (cp)) != AK_OK)
+ adios (NULL, "aliasing error in %s - %s", cp, akerror (i));
+ continue;
+ case NALIASW:
+ noalias++;
+ continue;
+
+ case LISTSW:
+ list++;
+ continue;
+ case NLISTSW:
+ list = 0;
+ continue;
+
+ case NORMSW:
+ normalize = AD_HOST;
+ continue;
+ case NNORMSW:
+ normalize = AD_NHST;
+ continue;
+
+ case USERSW:
+ inverted++;
+ continue;
+ case NUSERSW:
+ inverted = 0;
+ continue;
+ }
+ }
+ vec[vecp++] = cp;
- vec[vecp++] = cp;
- }
-
- if (!noalias) {
- /* allow Aliasfile: profile entry */
- if ((cp = context_find ("Aliasfile"))) {
- char *dp = NULL;
-
- for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap; ap++)
- if ((i = alias (*ap)) != AK_OK)
- adios (NULL, "aliasing error in %s - %s", *ap, akerror (i));
- if (dp)
- free(dp);
+
+ if (!noalias) {
+ /* allow Aliasfile: profile entry */
+ if ((cp = context_find ("Aliasfile"))) {
+ char *dp = NULL;
+
+ for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap; ap++)
+ if ((i = alias (*ap)) != AK_OK)
+ adios (NULL, "aliasing error in %s - %s", *ap, akerror (i));
+ if (dp)
+ free(dp);
+ }
+ alias (AliasFile);
- /*
- * If -user is specified
- */
- if (inverted) {
- if (vecp == 0)
- adios (NULL, "usage: %s -user addresses ... (you forgot the addresses)",
- invo_name);
+ /*
+ * If -user is specified
+ */
+ if (inverted) {
+ if (vecp == 0)
+ adios (NULL, "usage: %s -user addresses ... (you forgot the addresses)",
+ invo_name);
- for (i = 0; i < vecp; i++)
- print_usr (vec[i], list, normalize);
+ for (i = 0; i < vecp; i++)
+ print_usr (vec[i], list, normalize);
- done (0);
- }
-
- if (vecp) {
- /* print specified aliases */
- for (i = 0; i < vecp; i++)
- print_aka (akvalue (vec[i]), list, 0);
- } else {
- /* print them all */
- for (ak = akahead; ak; ak = ak->ak_next) {
- printf ("%s: ", ak->ak_name);
- pos += strlen (ak->ak_name) + 1;
- print_aka (akresult (ak), list, pos);
+ done (0);
+ }
+
+ if (vecp) {
+ /* print specified aliases */
+ for (i = 0; i < vecp; i++)
+ print_aka (akvalue (vec[i]), list, 0);
+ } else {
+ /* print them all */
+ for (ak = akahead; ak; ak = ak->ak_next) {
+ printf ("%s: ", ak->ak_name);
+ pos += strlen (ak->ak_name) + 1;
+ print_aka (akresult (ak), list, pos);
+ }
- register char *cp, *pp, *vp;
- register struct aka *ak;
- register struct mailname *mp, *np;
-
- if ((pp = getname (s)) == NULL)
- adios (NULL, "no address in \"%s\"", s);
- if ((mp = getm (pp, NULL, 0, norm, NULL)) == NULL)
- adios (NULL, "bad address \"%s\"", s);
- while (getname (""))
- continue;
-
- vp = NULL;
- for (ak = akahead; ak; ak = ak->ak_next) {
- pp = akresult (ak);
- while ((cp = getname (pp))) {
- if ((np = getm (cp, NULL, 0, norm, NULL)) == NULL)
+ register char *cp, *pp, *vp;
+ register struct aka *ak;
+ register struct mailname *mp, *np;
+
+ if ((pp = getname (s)) == NULL)
+ adios (NULL, "no address in \"%s\"", s);
+ if ((mp = getm (pp, NULL, 0, norm, NULL)) == NULL)
+ adios (NULL, "bad address \"%s\"", s);
+ while (getname (""))
- if (!strcasecmp (mp->m_host, np->m_host)
- && !strcasecmp (mp->m_mbox, np->m_mbox)) {
- vp = vp ? add (ak->ak_name, add (",", vp))
- : getcpy (ak->ak_name);
- mnfree (np);
- while (getname (""))
- continue;
- break;
- }
- mnfree (np);
+
+ vp = NULL;
+ for (ak = akahead; ak; ak = ak->ak_next) {
+ pp = akresult (ak);
+ while ((cp = getname (pp))) {
+ if ((np = getm (cp, NULL, 0, norm, NULL)) == NULL)
+ continue;
+ if (!mh_strcasecmp (mp->m_host, np->m_host)
+ && !mh_strcasecmp (mp->m_mbox, np->m_mbox)) {
+ vp = vp ? add (ak->ak_name, add (",", vp))
+ : getcpy (ak->ak_name);
+ mnfree (np);
+ while (getname (""))
+ continue;
+ break;
+ }
+ mnfree (np);
+ }