X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fali.c;fp=uip%2Fali.c;h=6b9dbf5f718f030687219ce2982b18a9cf9b142e;hp=21b95e1562e53668a4813501a821f366c34cf0fb;hb=714b5c530ece27ea2835a313013f5b770163403c;hpb=ced6090a330d3d83d0bce709f756aa3d7d65fea4 diff --git a/uip/ali.c b/uip/ali.c index 21b95e1..6b9dbf5 100644 --- a/uip/ali.c +++ b/uip/ali.c @@ -48,12 +48,12 @@ extern struct aka *akahead; /* ** prototypes */ -static void print_aka (char *, int, int); -static void print_usr (char *, int, int); +static void print_aka(char *, int, int); +static void print_usr(char *, int, int); int -main (int argc, char **argv) +main(int argc, char **argv) { int i, vecp = 0, inverted = 0, list = 0; int noalias = 0, normalize = AD_NHST; @@ -64,38 +64,38 @@ main (int argc, char **argv) #ifdef LOCALE setlocale(LC_ALL, ""); #endif - invo_name = r1bindex (argv[0], '/'); + invo_name = r1bindex(argv[0], '/'); /* read user profile/context */ context_read(); - mts_init (invo_name); - arguments = getarguments (invo_name, argc, argv, 1); + mts_init(invo_name); + arguments = getarguments(invo_name, argc, argv, 1); argp = arguments; while ((cp = *argp++)) { if (*cp == '-') { - switch (smatch (++cp, switches)) { + switch (smatch(++cp, switches)) { case AMBIGSW: - ambigsw (cp, switches); - done (1); + ambigsw(cp, switches); + done(1); case UNKWNSW: - adios (NULL, "-%s unknown", cp); + adios(NULL, "-%s unknown", cp); case HELPSW: - snprintf (buf, sizeof(buf), "%s [switches] aliases ...", + snprintf(buf, sizeof(buf), "%s [switches] aliases ...", invo_name); - print_help (buf, switches, 1); - done (1); + print_help(buf, switches, 1); + done(1); case VERSIONSW: - print_version (invo_name); - done (1); + 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)); + 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++; @@ -128,16 +128,16 @@ main (int argc, char **argv) if (!noalias) { /* allow Aliasfile: profile entry */ - if ((cp = context_find ("Aliasfile"))) { + 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 ((i = alias(*ap)) != AK_OK) + adios(NULL, "aliasing error in %s - %s", *ap, akerror(i)); if (dp) free(dp); } - alias (AliasFile); + alias(AliasFile); } /* @@ -145,39 +145,39 @@ main (int argc, char **argv) */ if (inverted) { if (vecp == 0) - adios (NULL, "usage: %s -user addresses ... (you forgot the addresses)", + adios(NULL, "usage: %s -user addresses ... (you forgot the addresses)", invo_name); for (i = 0; i < vecp; i++) - print_usr (vec[i], list, normalize); + print_usr(vec[i], list, normalize); - done (0); + done(0); } if (vecp) { /* print specified aliases */ for (i = 0; i < vecp; i++) - print_aka (akvalue (vec[i]), list, 0); + 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); + printf("%s: ", ak->ak_name); + pos += strlen(ak->ak_name) + 1; + print_aka(akresult(ak), list, pos); } } - done (0); + done(0); return 1; } static void -print_aka (char *p, int list, int margin) +print_aka(char *p, int list, int margin) { char c; if (p == NULL) { - printf ("\n"); + printf("\n"); return; } @@ -186,13 +186,13 @@ print_aka (char *p, int list, int margin) case ',': if (*p) { if (list) - printf ("\n%*s", margin, ""); + printf("\n%*s", margin, ""); else { if (pos >= 68) { - printf (",\n "); + printf(",\n "); pos = 2; } else { - printf (", "); + printf(", "); pos += 2; } } @@ -203,55 +203,55 @@ print_aka (char *p, int list, int margin) default: pos++; - putchar (c); + putchar(c); } } - putchar ('\n'); + putchar('\n'); pos = 1; } static void -print_usr (char *s, int list, int norm) +print_usr(char *s, int list, int norm) { 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 ((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) + 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 ("")) + 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); + mnfree(np); } } - mnfree (mp); + mnfree(mp); #if 0 - printf ("%s: ", s); - print_aka (vp ? vp : s, list, pos += strlen (s) + 1); + printf("%s: ", s); + print_aka(vp ? vp : s, list, pos += strlen(s) + 1); #else - print_aka (vp ? vp : s, list, 0); + print_aka(vp ? vp : s, list, 0); #endif if (vp) - free (vp); + free(vp); }