uupath(1) - print full uucp path or route

Mikel Manitius mikel at codas.ATT.UUCP
Thu Jul 10 02:50:52 AEST 1986


> Nice program, but let me show a 1 line shell script that does the
> same thing AND doesn't depend on dbm.  (It does, however, depend
> on the "look" command, which is in the same category as dbm, it's
> from AT&T, in V7, but not in System III or V.  The program does a
> binary search on a text file, is fairly short, and someone could
> write a public domain version, possibly using public domain code
> in smail as a starting point, easily.)  This also assumes your
> paths file is sorted with "sort -f", which we recommend:
>  [ ... ]
> 
> 	Mark

That was the first thing I did when I got smail.
It is *very* kludgy, but easy and simple, and it
works!
---------begin route.c---------
main(argc, argv)
int	argc;
char	*argv[];
{
	char	user[BUFSIZ];
	char	domain[BUFSIZ];

	resolve(argv[1], user, domain);
	if(domain[0] == '\0')
		printf("%s\n", user);
	else if(user[0] == '\0')
		printf("%s\n", domain);
	else
		printf("%s!%s\n", user, domain);
}
----------end route.c----------

And add this to your smail Makefile:

----------begin
route:		$(OBJECTS)
		rm -f xmain.c
		sed -e 's/^main/niam/' < main.c > xmain.c
		cc $(CFLAGS) -c xmain.c
		cc $(ROBJECTS) xmain.o route.c -o route
		rm -f xmain.o xmain.c
-----------end

Then do a "make route".
-- 
    ___
   /   \		Mikel Manitius @ AT&T-IS Altamonte Springs, FL
  | RPI |		...{seismo!akgua|ihnp4|cbosgd|mcnc}!codas!mikel
  |  .  | 
\\-------//



More information about the Comp.sources.unix mailing list