Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!seismo!nbires!hao!hplabs!pesnta!peora!codas!mikel From: mikel@codas.ATT.UUCP (Mikel Manitius) Newsgroups: net.sources Subject: Re: uupath(1) - print full uucp path or route Message-ID: <623@codas.ATT.UUCP> Date: Wed, 9-Jul-86 12:50:52 EDT Article-I.D.: codas.623 Posted: Wed Jul 9 12:50:52 1986 Date-Received: Fri, 11-Jul-86 06:22:23 EDT References: <1032@rlgvax.UUCP> <2267@cbosgd.UUCP> Organization: AT&T Information Systems, Altamonte Springs, FL Lines: 51 > 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 | . | \\-------//