9 date 93.09.02.00.05.15; author jromine; state Exp;
14 date 92.12.15.00.20.22; author jromine; state Exp;
19 date 92.11.04.00.37.27; author jromine; state Exp;
24 date 92.02.10.17.33.44; author jromine; state Exp;
29 date 92.02.10.17.17.34; author jromine; state Exp;
34 date 92.01.31.22.06.17; author jromine; state Exp;
39 date 90.04.05.15.03.38; author sources; state Exp;
44 date 90.03.16.15.27.13; author sources; state Exp;
49 date 90.03.13.14.21.39; author sources; state Exp;
60 @read AliasFile (system default) in same order as post does
63 @/* ali.c - the new ali */
65 static char ident[] = "@@(#)$Id: ali.c,v 1.8 1992/12/15 00:20:22 jromine Exp jromine $";
69 #include "../h/addrsbr.h"
70 #include "../h/aliasbr.h"
77 #define NVEC 50 /* maximum number of names */
81 static struct swit switches[] = {
112 extern struct aka *akahead;
137 setlocale(LC_ALL, "");
139 invo_name = r1bindex (argv[0], '/');
140 mts_init (invo_name);
141 if ((cp = m_find (invo_name)) != NULL) {
142 ap = brkstring (cp = getcpy (cp), " ", "\n");
143 ap = copyip (ap, arguments);
147 (void) copyip (argv + 1, ap);
152 while (cp = *argp++) {
154 switch (smatch (++cp, switches)) {
156 ambigsw (cp, switches);
159 adios (NULLCP, "-%s unknown", cp);
161 (void) sprintf (buf, "%s [switches] aliases ...",
163 help (buf, switches);
167 if (!(cp = *argp++) || *cp == '-')
168 adios (NULLCP, "missing argument to %s", argp[-2]);
169 if ((i = alias (cp)) != AK_OK)
170 adios (NULLCP, "aliasing error in %s - %s",
202 if (cp = m_find ("Aliasfile")) { /* allow Aliasfile: profile entry */
205 for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap; ap++)
206 if ((i = alias (*ap)) != AK_OK)
208 "aliasing error in %s - %s", *ap, akerror (i));
212 (void) alias (AliasFile);
219 for (i = 0; i < vecp; i++)
221 print_usr (vec[i], list, normalize);
223 print_aka (akvalue (vec[i]), list, 0);
227 "usage: %s -user addresses ... (you forgot the addresses)",
230 for (ak = akahead; ak; ak = ak -> ak_next) {
231 printf ("%s: ", ak -> ak_name);
232 pos += strlen (ak -> ak_name) + 1;
233 print_aka (akresult (ak), list, pos);
242 print_aka (p, list, margin)
250 printf ("<empty>\n");
259 printf ("\n%*s", margin, "");
278 (void) putchar ('\n');
284 print_usr (s, list, norm)
292 register struct aka *ak;
293 register struct mailname *mp,
296 if ((pp = getname (s)) == NULL)
297 adios (NULLCP, "no address in \"%s\"", s);
298 if ((mp = getm (pp, NULLCP, 0, norm, NULLCP)) == NULL)
299 adios (NULLCP, "bad address \"%s\"", s);
304 for (ak = akahead; ak; ak = ak -> ak_next) {
306 while (cp = getname (pp)) {
307 if ((np = getm (cp, NULLCP, 0, norm, NULLCP)) == NULL)
309 if (uleq (mp -> m_host, np -> m_host)
310 && uleq (mp -> m_mbox, np -> m_mbox)) {
311 vp = vp ? add (ak -> ak_name, add (",", vp))
312 : getcpy (ak -> ak_name);
325 print_aka (vp ? vp : s, list, pos += strlen (s) + 1);
327 print_aka (vp ? vp : s, list, 0);
342 static char ident[] = "@@(#)$Id: ali.c,v 1.7 1992/11/04 00:37:27 jromine Exp jromine $";
344 (void) alias (AliasFile);
356 static char ident[] = "@@(#)$Id: ali.c,v 1.6 1992/02/10 17:33:44 jromine Exp jromine $";
363 @allow "Aliasfile" to be multiple files
368 static char ident[] = "@@(#)$Id: ali.c,v 1.5 1992/02/10 17:17:34 jromine Exp jromine $";
376 @make -user more self-consistent -- don't output "arg: " before
382 static char ident[] = "@@(#)$Id: ali.c,v 1.4 1992/01/31 22:06:17 jromine Exp jromine $";
385 if (cp = m_find ("Aliasfile")) /* allow Aliasfile: profile entry */
386 if ((i = alias (cp)) != AK_OK)
387 adios (NULLCP, "aliasing error in %s - %s", cp, akerror (i));
398 static char ident[] = "@@(#)$Id: ali.c,v 1.3 1990/04/05 15:03:38 sources Exp jromine $";
401 adios (NULLCP, "usage: %s addresses ... (you forgot the addresses)",
414 static char ident[] = "@@(#)$Id:$";
426 @add "Aliasfile: file" profile entry (like -alias file)