jsq@ut-sally.UUCP (John Quarterman) (02/05/85)
: This is a shar archive. Extract with sh, not csh. echo x - README sed -e 's/^X//' > README << '!RoNnIe!RaYgUn!' XThis is the source directory for uuhosts, which may be used to display Xinformation from the USENET newsgroups mod.map.uucp and mod.map.news. XMail routing information as produced by pathalias is also displayed. XSince uuhosts needs the map information from the USENET spool directories Xextracted into a more accessible (and permanent) location, it can be Xused to do that, too. X XIf you don't have a UNIX group named news in /etc/group, you should Xcreate one, as uuhosts depends on it. X XTo install uuhosts, first look at the beginning of the Makefile and Xadjust any pathnames which are incorrect for your system. Then do X"make" to be sure everything compiles correctly. To install the Xnecessary shell script, C program, and manual entry, as well as Xcreating all necessary new directories, do "make install" as root. XFinally, modify NEWS/sys by hand so that inews will call "uuhosts -x" Xwhen mod.map.all articles arrive. See uuhosts(1) for how to do this. X XOnce the program is installed, you will want to feed any existing Xmod.map.all articles through "uuhosts -x" so they will be extracted and Xuuhosts can later be used to display the information. To do this, type X"uuhosts -setup &". Do not do it as root: do it as some user in group Xnews. It will take a while: display speed has been bought by slowness Xin extraction. You should only ever need to do this once, as any Xmod.map.all articles that arrive later should be extracted Xautomatically because of the NEWS/sys entry. X X XThis posting of uuhosts works with the latest (January 1985) Xmod.map.uucp postings and the latest mod.map.news postings. X XPathalias is not included here: it was posted to net.sources a while Xback. If you have uupath, you may want to use it to look up UUCP Xrouting information instead of the method uuhosts uses by default. XJust look for uupath in uuhosts.sh and it's obvious what to change. X X XFor the mod.map.all extraction (and *only* that extraction), uuhosts Xdepends on a small setuid program called mapsh (included here) which Xuses chroot(2), which is in (at least) 4BSD, System N, and Version 7. XThe purpose of mapsh is to limit the commands which may be executed Xwhen found in a map article. If you trust everyone who can post to XUSENET from any machine in the world, you can probably replace mapsh Xwith "cd $MAPS; sh". Or you can use unmvax!lee's article parser in C, Xif you like. X X XHere is an example of the most common use of uuhosts, which is to Xdisplay information about a particular host: X X% uuhosts cbosgd XUUCP mail path for cbosgd: Xcbosgd seismo!cbosgd!%s X XUUCP mail host information for cbosgd: X#Name cbosgd X#System-CPU-OS X#Organization AT&T Bell Laboratories, Columbus (cb) X#Contact mark horton X#Electronic-Address cbosgd!mark X#Telephone (614)860-4276 X#Postal-Address 2C-249;6200 East Broad Street;Columbus, OH 43213 X#Latitude-Longitude X#Remarks X#Written-by 840626 ihnp4!action X# Xcbosgd ATT-ACTION, X aat(DEMAND), bang(DEMAND), bragvax(DEMAND), brl-bmd(DEMAND), X cca(DEMAND), cwruecmp(DEMAND), decvax(DEMAND), dual(DEMAND), X duke(DEMAND), excelan(DEMAND), fortune(DEMAND), garfield(DEMAND), X genrad(DEMAND), hasmed(DAILY), hcr(DEMAND), ho95b(DEMAND), X hp-lsd(DEMAND), hplabs(DEMAND), hugo(DEMAND), idi(DEMAND), X idis(DEMAND), ima(DEMAND), ittvax(DEMAND), jett(DEMAND), X lbl-csam(DEMAND), linus(DEMAND), looking(DEMAND), lzmi(DEMAND), X mddc(DEMAND), mss(DEMAND), nbires(DEMAND), ncrday(DEMAND), X neoucom(DEMAND), netword(DEMAND), nmtvax(DEMAND), nsc(DEMAND), X okstate(DEMAND), philabs(DEMAND), plus5(DEMAND), politik(DEMAND), X psuvax1(DEMAND), qubix(DEMAND), randvax(DEMAND), rice(DEMAND), X rlgvax(DEMAND), sanant(DEMAND), scgvaxd(DEMAND), sco(DEMAND), X sdcarl(DEMAND), sdcrdcf(DEMAND), seismo(DEMAND), sfwin(DEMAND), X sfbai(DEMAND), sfbam(DEMAND), sfjec(DEMAND), stcvax(DEMAND), X sun(DEMAND), sunbird(DEMAND), t4test(DEMAND), talcott(DEMAND), X ucbvax(DEMAND), uicsovax(DEMAND), umcp-cs(DEMAND), unm-ivax(DEMAND), X usenix(DEMAND), utah-cs(DEMAND), utcs(DEMAND), uvacs(DEMAND), X vortex(DEMAND), washu(DEMAND), wu1(DEMAND), zehntel(DEMAND), X zinfandel(DEMAND), wjh12(DEMAND), X apr(DEMAND), caribou(DEMAND), chemabs(DEAD), osu-eddie(DEMAND), X cbdbms(LOCAL), cbdkc1(LOCAL), cbnee(LOCAL), cbnmb(LOCAL), X cbosg(LOCAL), cbosgb(LOCAL), cbosge(LOCAL), cbmis(LOCAL), X cbscc(LOCAL), cbuxb(LOCAL), eadas(LOCAL), eadast(LOCAL), X ndbcb(LOCAL), ncpx(LOCAL), ncpa(LOCAL), ncpc(LOCAL), X ncpx(LOCAL), ncpe(LOCAL), ncpf(LOCAL), ncpg(LOCAL), X ncph(LOCAL), noc(LOCAL), nscs(LOCAL), cbnscs(LOCAL), X nsc3b2(LOCAL), sescct(LOCAL), sescent(LOCAL) X X XUSENET news host information for cbosgd: XName: cbosgd XOrganization: AT&T Bell Laboratories, Operating Systems Group XContact: Mark Horton XPhone: (614) 860-4276 XPostal-Address: Rm. 2C-249, 6200 E. Broad St., Columbus, OH 43213 XElectronic-Address: cbosg!cbosgd!mark XNews: ihnp4 cbnscs hasmed cbdkc1 cbuxc cbrmc neoucom cbsck osu-eddie clyde XMail: neoucom psuvax1 atlas XComments: last edited 12/1/84 X !RoNnIe!RaYgUn! echo x - uuhosts.sh sed -e 's/^X//' > uuhosts.sh << '!RoNnIe!RaYgUn!' X#!/bin/sh X# '@(#) uuhosts.sh 1.48 85/02/02' X# uuhosts - USENET news and UUCP mail host information X XBIN=/usr/local XLIB=/usr/local/lib XNEWS=$LIB/news XMAPS=$NEWS/maps XNEWSMAPGROUP=mod.map.news XUUCPMAPGROUP=mod.map.uucp XNEWSMAP=$NEWSMAPGROUP XUUCPMAP=$UUCPMAPGROUP XMAPSH=$NEWS/mapsh XNEWSSPOOL=/usr/spool/news/mod/map/news XUUCPSPOOL=/usr/spool/news/mod/map/uucp X X# Routing information produced by pathalias. XPATHS=$LIB/nmail.paths X# Munged by uuwhere for location information. XWHERE=$LIB/nmail.where X X# The directories $MAPS/$NEWSMAP and $MAPS/$UUCPMAP contain the map information X# extracted from the newsgroups mod.map.news (for the USENET news map) X# and mod.map.uucp (for the UUCP mail map). The extraction is done by X# a line in $NEWS/sys like this: X X# maps:mod.map.news,mod.map.uucp:B:$BIN/uuhosts -x X X# $MAPSH is needed, to use the chroot(2) system call to limit X# what can be done when executing a shell with a news article as input. X# N.B.: chroot is *only* needed for *automatic extraction* of news X# articles from mod.map.all; it has nothing to do with display of X# the information by ordinary users. X X# Initial installation is done by "make install" as root, followed X# by "uuhosts -setup" as some user in group news. X Xcd $NEWS X Xcase $1 in X -setup) X # Initial setup. Should only need to be done once. X DONTINDEX=1 X export DONTINDEX X cd $NEWSSPOOL X for f in * X do X uuhosts -x < $f X sleep 30 X done X cd $UUCPSPOOL X for f in * X do X uuhosts -x < $f X sleep 30 X done X exec uuhosts -i X ;; X X -x) X # extract a new map piece into a map directory X temphead=/tmp/maphead.$$ X temptext=/tmp/maptext.$$ X tempcomm=/tmp/mapcomm.$$ X cp /dev/null $temphead X cp /dev/null $temptext X echo 'exec /bin/mail usenet' > $tempcomm X awk ' XBEGIN { X temphead = "'$temphead'"; tempcomm = "'$tempcomm'"; X typeset = 0; isnewsmap = 0; isuucpmap = 0; X shead = 0; stext = 1; snews = 2; suucp = 3; X state = shead; X} Xstate == shead && ($1 == "From:" || $1 == "Sender:" \ X || $1 == "Date:" || $1 == "Message-ID:" || $1 == "Message-Id:") { X print "Original-" $0 >> temphead; X next; X} Xstate == shead && $1 == "Newsgroups:" { # no cross-postings allowed X if ($2 == "'$NEWSMAPGROUP'") { X isnewsmap = 1; X typeset = 1; X print "Reply-To: usenet" >> temphead; X print "exec /bin/mail usenet" > tempcomm; X } else if ($2 == "'$UUCPMAPGROUP'") { X isuucpmap = 1; X typeset = 1; X print "Reply-To: postmaster" >> temphead; X print "exec /bin/mail postmaster" > tempcomm; X } X} Xstate == shead && $1 == "Subject:" { X if ($1 == "Re:" || $1 == "RE:" || $1 == "re:"\ X || !typeset) { # this requires Newsgroups: before Subject: X print "Subject: not a map update" >> temphead; X print "Original-" $0 >> temphead; X } else X print $0 >> temphead; X next; X} Xstate == shead && /^$/ { X if (isnewsmap != 0) { X print "PATH=/bin; umask 0002; cd '$NEWSMAP'" | "uuhosts -nx"; X state = snews; X } else if (isuucpmap != 0) { X print "PATH=/bin; umask 0002; cd '$UUCPMAP'" | "uuhosts -ux"; X state = suucp; X } else X state = stext; X} Xstate == shead { X print $0 >> temphead; X} Xstate == snews { X print | "uuhosts -nx"; X} Xstate == suucp { X print | "uuhosts -ux"; X} Xstate == stext { X print; X} X' > $temptext 2>&1 X cat $temphead $temptext | sh $tempcomm X rm -f $temphead $temptext $tempcomm X exit 0 X ;; X X -ux) X # extract a UUCP map piece X $MAPSH X if [ ${DONTINDEX}0 -eq 0 ]; then X exec uuhosts -ui X fi X exit 0 X ;; X X -nx) X # extract a USENET map piece X $MAPSH X if [ ${DONTINDEX}0 -eq 0 ]; then X exec uuhosts -ni X fi X exit 0 X ;; X X -i) X uuhosts -ui X uuhosts -ni X exit 0 X ;; X X -ui) X # make an index for the UUCP map X exec uuhosts -mi $MAPS/$UUCPMAP "#N" X exit 1 X ;; X X -ni) X # make an index for the NEWS map X exec uuhosts -mi $MAPS/$NEWSMAP "Name:" X exit 1 X ;; X X -mi) X cd $2 X hostmarker=$3 X if [ ! -f Local ]; then X cp /dev/null Local X fi X cp /dev/null Index.t.$$ X for f in Local [a-z]* X do X awk ' XBEGIN { X isinside = 0; X hostmarker = "'"$hostmarker"'"; X} X$1 == hostmarker { X if (isinside) X printf ("%s\t%s\t%d\t%d\n", hostname, FILENAME, firstline, NR - 1); X isinside = 1; X hostname = $2; X firstline = NR; X} XEND { X if (isinside) X printf ("%s\t%s\t%d\t%d\n", hostname, FILENAME, firstline, NR); X exit (0); X} X' $f >> Index.t.$$ X done X sort -f Index.t.$$ > Index.s.$$ X mv Index.s.$$ Index X rm Index.t.$$ X exit 0 X ;; X X -u) X # UUCP mail map by region X cd $MAPS/$UUCPMAP X shift X if [ $# -eq 0 ]; then X exec ls X exit 1 X fi X exec cat $* X exit 1 X ;; X X -n) X # USENET news map by region X cd $MAPS/$NEWSMAP X shift X if [ $# -eq 0 ]; then X exec ls X exit 1 X fi X exec cat $* X exit 1 X ;; X X -k) X # USENET map by keyword X cd $MAPS/$NEWSMAP X shift X exec awk ' XBEGIN { inside = 1; outside = 0; state = outside; } X/^Name:/ { state = inside; count = 0; useit = 0; } Xstate == inside { block[count++] = $0; } X/'"$*"'/ { useit = 1; } X/^$/ && state == inside { X if (useit == 1) { X for (i = 0; i < count; i++) { X print block[i]; X } X } X state = outside; X} X' * X exit 1 X ;; X X -*) X # unknown option X ;; X X "") X # no arguments X ;; X X *) X # by host name X if [ -f /usr/bin/look ]; then X look=/usr/bin/look X lookopt="-f " X else X look=grep X lookopt="^" X fi X for arg in $* X do X echo 'UUCP mail path for '$arg':' X $look $lookopt$arg $PATHS X# uupath $arg X if [ -f $WHERE ]; then X echo 'UUCP mail path for '$arg' annotated by location:' X $look $lookopt$arg $WHERE X $LIB/uuwhere & X fi X echo ' XUUCP mail host information for '$arg':' X cd $MAPS/$UUCPMAP X eval `$look $lookopt$arg Index | awk ' X/^'$arg'/ { X printf ("sed -n -e \"%d,%dp\" %s;\n", $3, $4, $2); X}'` | sed -e ' Xs/^#N/#Name / Xs/^#S/#System-CPU-OS / Xs/^#O/#Organization / Xs/^#C/#Contact / Xs/^#E/#Electronic-Address/ Xs/^#T/#Telephone / Xs/^#P/#Postal-Address / Xs/^#L/#Latitude-Longitude/ Xs/^#R/#Remarks / Xs/^#W/#Written-by /' X cd $MAPS/$NEWSMAP X echo ' XUSENET news host information for '$arg':' X eval `$look $lookopt$arg Index | awk ' X/^'$arg'/ { X printf ("sed -n -e \"%d,%dp\" %s;\n", $3, $4, $2); X}'` X done X exit 0 X ;; Xesac X Xecho 'Usage: 'uuhosts' hostname ... Xfor information about a particular UUCP or USENET host or hosts, or X X 'uuhosts' -n USENET-news-region Xfor information about hosts in a region of the USENET news network, or X X 'uuhosts' -u UUCP-mail-region Xfor information about hosts in a region of the UUCP mail network, or X X "'uuhosts' -n" or "'uuhosts' -u" Xfor a list of known USENET or UUCP network regions. X XSee uuhosts(1) for further details and more obscure options. X' Xexit 1 !RoNnIe!RaYgUn! echo x - mapsh.c sed -e 's/^X//' > mapsh.c << '!RoNnIe!RaYgUn!' X#include <stdio.h> X/* X This command depends on chroot(2), which exists in 4BSD, System V, X Version 7, and probably all related systems. X */ X X#ifndef MAPS X#define MAPS "/usr/local/lib/news/maps" X#endif X Xmain(argc,argv) Xint argc; Xchar **argv; X{ X char *rootdir = MAPS; X char *command = "/bin/sh"; X X if (geteuid() != 0) { X fprintf (stderr, "mapsh must be setuid to root\n"); X exit(1); X } X if (chroot(rootdir) == -1) { X fprintf (stderr, "mapsh: chroot(%s) failed\n", rootdir); X perror (""); X exit(1); X } X if (setuid(getuid()) == -1) { X perror ("mapsh: setuid(getuid()) failed"); X exit(1); X } X if (chdir("/") == -1) { X fprintf (stderr, "mapsh: chdir(%s) failed\n", "/"); X perror (""); X exit(1); X } X execvp (command, argv); X fprintf (stderr, "mapsh: %s not found\n", command); X perror ("mapsh: execvp(2) failed"); X exit(1); X} !RoNnIe!RaYgUn! echo x - uuwhere.c sed -e 's/^X//' > uuwhere.c << '!RoNnIe!RaYgUn!' X#ifndef lint Xchar sccsid[] = "@(#) uuwhere.c 1.8 85/02/05"; X#endif X/* X * uuwhere: X * This program is designed to take the ASCII UUCP routing database PATHS X * on standard input, and produce a version * on standard output annotated X * by host location, to be put in WHERE. It gets the location information X * from the news and UUCP map directories produced by uuhosts. X * UUCP map information is made to override news map information. X * The host location information is first put into a dbm(3x) X * database so that generating the final output will not take forever. X */ X X#include <stdio.h> X#include <ctype.h> X#include <dbm.h> X#include <sys/types.h> X#include <sys/stat.h> X X#ifndef UUCPINDEX X#define UUCPINDEX "/usr/local/lib/news/maps/mod.map.uucp/Index" X#endif X#ifndef NEWSINDEX X#define NEWSINDEX "/usr/local/lib/news/maps/mod.map.news/Index" X#endif X#ifndef TMP X#define TMP "/usr/local/lib/nmail.tmp" X#endif X#ifndef PATHS X#define PATHS "/usr/local/lib/nmail.paths" X#endif X#ifndef WHERE X#define WHERE "/usr/local/lib/nmail.where" X#endif X#ifndef DATABASE X#define DATABASE "/usr/local/lib/uuindex" X#endif X Xint verbose; X Xmain(argc, argv) Xint argc; Xchar **argv; X{ X register char **cp; X int flagcreat = 0; X int flagupdate = 1; X int flaginput = 0; X X (void) umask(0); X for (cp = argv; *++cp != NULL; ) { X if (**cp != '-') { X flaginput = 1; X flagupdate = 0; X break; X } X switch (cp[0][1]) { X case '\0': X flaginput = 1; X flagupdate = 0; X break; X case 'c': X flagcreat = 1; X flagupdate = 0; X break; X case 'v': X verbose = 1; X break; X default: X usage(); X break; X } X } X init(flagcreat, flagupdate, flaginput); X if (!flaginput) { X char tmpbuf[64]; X X if (freopen (PATHS, "r", stdin) == (FILE *)NULL) { X perror (PATHS); X exit (1); X } X (void)sprintf(tmpbuf, "%s.%d", TMP, getpid()); X if (freopen (tmpbuf, "w", stdout) == (FILE *)NULL) { X perror (tmpbuf); X exit (1); X } X parsefile(); X (void)fclose(stdout); X if (unlink (WHERE) == -1 || link(tmpbuf, WHERE) == -1) { X perror(WHERE); X exit(1); X } X (void)unlink(tmpbuf); X exit (0); X } X for (; *cp != NULL; cp++) { X if (strcmp (*cp, "-") != 0 X && freopen (*cp, "r", stdin) == (FILE *)NULL) { X perror (*cp); X continue; X } X parsefile(); X } X exit(0); X} X Xusage() X{ X fprintf (stderr, "usage: uuwhere [-c] [-v] [infiles]\n"); X exit (1); X} X Xinit(flagcreat, flagupdate, flaginput) Xint flagcreat, flagupdate, flaginput; X{ X char datadir[512], datapag[512]; X struct stat statuucp, statpaths, statwhere; X int fd; X char c; X X/* X * If any of the stats fail, X * an open will fail later and produce a diagnostic. X */ X if (flagupdate X && stat(WHERE, &statwhere) != -1 X && stat(PATHS, &statpaths) != -1 X && stat(UUCPINDEX, &statuucp) != -1) { X if (statwhere.st_mtime > statpaths.st_mtime X && statwhere.st_mtime > statuucp.st_mtime) { X if (verbose) X fprintf (stderr, "%s up to date\n", WHERE); X exit(0); X } X if (statuucp.st_mtime > statwhere.st_mtime X || statuucp.st_mtime > statpaths.st_mtime) X flagcreat = 1; X } X if (!flaginput) { X /* touch WHERE to forestall duplicate uuwheres */ X if ((fd = open(WHERE, 2)) < 0) { X perror(WHERE); X exit(1); X } X if (read (fd, &c, 1) == 1) X (void) write (fd, &c, 1); X (void) close (fd); X } X (void) sprintf (datadir, "%s.dir", DATABASE); X (void) sprintf (datapag, "%s.pag", DATABASE); X if (flagcreat || access(datadir, 0) == -1 || access(datapag, 0) == -1) { X flagcreat = 1; X if (verbose) X fprintf (stderr, "Creating database %s...\n", DATABASE); X if (makefile(datadir) == -1 || makefile(datapag) == -1) X exit(1); X } X if (dbminit(DATABASE) < 0) X exit(1); X if (!flagcreat) X return; X if (!initit(NEWSINDEX) && !initit(UUCPINDEX)) X exit(1); X if (verbose) X fprintf (stderr, "...database %s created.\n", DATABASE); X} X Xmakefile(name) Xchar *name; X{ X register int fd; X X if ((fd = creat(name, 0666)) == -1) { X perror(name); X return(-1); X } X (void) close(fd); X return (0); X} X Xinitit(name) Xchar *name; X{ X register FILE *fp; X char buffer[1024], site[128], where[128]; X datum key, data; X X if (verbose) X fprintf(stderr, "Reading %s...", name); X if ((fp = fopen(name, "r")) == (FILE *)NULL) { X perror(name); X return (0); X } X while (fgets(buffer, sizeof(buffer), fp) != NULL) { X if (sscanf(buffer, "%s%s", site, where) != 2) { X fprintf (stderr, "Can't parse: %s\n", buffer); X continue; X } X key.dptr = site; X key.dsize = strlen(key.dptr) + 1; X data.dptr = where; X data.dsize = strlen(data.dptr) + 1; X store (key, data); X } X (void)fclose(fp); X if (verbose) X fprintf(stderr, ".\n"); X return(1); X} X Xparsefile() X{ X char buffer[128]; X register char *cp; X register int c; X register int inside; X register int last = 0; X X for (inside = 0; (c = getchar()) != EOF; (void)putchar(c)) { X if (isalnum(c) || (c) == '.' || (c) == '-' || (c) == '_') { X if (!inside) { X cp = buffer; X inside = 1; X } X *cp++ = c; X continue; X } X if (inside) { X *cp = '\0'; X if (cp != buffer X/* %s */ && !((cp - buffer) == 1 && last == '%' && buffer[0] == 's')) X doit(buffer); X inside = 0; X } X last = c; X } X} X Xdoit (site) Xchar *site; X{ X datum key, data; X X key.dptr = site; X key.dsize = strlen(key.dptr) + 1; X data = fetch(key); X if (data.dptr != NULL) X printf ("(%s)", data.dptr); X} !RoNnIe!RaYgUn! echo x - uuhosts.man sed -e 's/^X//' > uuhosts.man << '!RoNnIe!RaYgUn!' X.TH UUHOSTS 1L 85/02/02 X.SH NAME Xuuhosts \- USENET news and UUCP mail information. X.SH SYNOPSIS X.B Xuuhosts Xhostname ... X.br X.B Xuuhosts X-u [ UUCP-mail-region ] X.br X.B Xuuhosts X-n [ USENET-news-region ] X.br X.B Xuuhosts X-x X.SH DESCRIPTION XThe \fIuuhosts\fP command is used to look up information about Xthe configurations of the UUCP mail network and the USENET news network. X.TP Xuuhosts \fIhostname\fP ... Xfor information about a particular UUCP or USENET host or hosts. XThe UUCP mail path is given first, followed by the UUCP mail map Xinformation, and then the USENET news map information. XAny hosts with names for which the argument is a prefix are shown, e.g.: X.TP Xuuhosts ut Xgets information about all hosts whose names start with ``ut''. X.TP Xuuhosts \-n \fIUSENET-news-region\fP Xfor information about hosts in a region of the USENET news network. X.TP Xuuhosts \-n README Xgets an introduction to the USENET news map. X.TP Xuuhosts \-n Local Xgets USENET news information known only locally. X.TP Xuuhosts \-n Xfor a list of known USENET regions. X.TP Xuuhosts \-u Xgets a list of regions of the UUCP mail network, and X.TP Xuuhosts \-u \fIUUCP-mail-region\fP Xretrieves information about UUCP hosts in that region. XThere may be a Local region, as for the USENET map. X.TP Xuuhosts Xwith no arguments gets a short usage message. X.SH MAINTENANCE XIn addition to the options mentioned above, there is X.TP Xuuhosts \-x XExtract pieces of the USENET news or UUCP mail maps from a Xmod.map.news or mod.map.uucp article. X.PP XThis should be called automatically by a line in \fBNEWS/sys\fP like X.IP Xmaps:mod.map.news,mod.map.uucp:B:BIN/uuhosts\ \-x X.TP Xuuhosts \-i Xrebuilds all the Index files (see below). X.LP XThere are more details in the uuhosts shell script itself. X.SH FILES X.TP XPATHS XUUCP mail path database as produced by \fIpathalias\fP and used by \fInmail\fP X(which is called automatically from \fIsendmail\fP on \fIut\-sally\fP) XIt is searched by \fIlook\fP(1), if present, else \fIgrep\fP(1). XThe file WHERE is similarly searched, if present: Xsee \fIuuwhere\fP(1). X.TP XNEWSMAP XUSENET news site information taken from newsgroup \fBmod.map.news\fP X(thanks to \fBcbosgd!map\fP). XNotices of updates are mailed to usenet, which should be an alias Xredistributing to the local USENET administrators. X.TP XNEWSMAP/Index XThis index is used to decrease search time on the map about an order Xof magnitude. XThe search is done by either \fIlook\fP(1) or \fIgrep\fP(1), as above. XThe index is updated each time a mod.map.news article arrives, Xand may be manually forced by ``uuhosts\ \-ni''. X.TP XUUCPMAP XUUCP mail site information taken from newsgroup \fBmod.map.uucp\fP X(thanks to the UUCP mapping project). XNotices of updates are mailed to postmaster, which should be an alias Xredistributing to the local mail and UUCP administrators. X.TP XUUCPMAP/Index XLike the corresponding file in the mod.map.news directory. XA manual update may be forced by ``uuhosts\ \-ui''. X.TP XNEWS/sys XContains arrangements to call "uuhosts\ \-x". X.SH SEE ALSO Xvnews(1), readnews(1), mail(1), sendmail(8), look(1) X.SH BUGS XHaving uuhosts\ \-x create a complete new Index for each incoming article Xis clumsy, takes a long time, and eats CPU. XOn the other hand, articles don't come in but once or twice a month. XIf anybody has a clever method of handling this (given that ordinary Xusers may read but not write on the map directories), let me know. X.sp X.nf XJohn Quarterman, CS Dept., University of Texas, Austin, Texas 78712 USA Xjsq@ut-sally.ARPA, jsq@ut-sally.UUCP, {ihnp4,seismo,ctvax}!ut-sally!jsq !RoNnIe!RaYgUn! echo x - uuwhere.man sed -e 's/^X//' > uuwhere.man << '!RoNnIe!RaYgUn!' X.TH UUW\HERE 1L 85/02/02 X.SH NAME Xuuwhere \- annotate UUCP mail routes by host location X.SH SYNOPSIS X.B XLIB/uuwhere X[ -c ] X[ infile ] X.SH DESCRIPTION XThe \fIuuwhere\fP command is used take a list of UUCP routes, Xsuch as produced by \fIpathalias\fP, and make a similar list, Xannotated by the geographical location of each host as found Xin the UUCP map posted to USENET newsgroup mod.map.uucp. XIt is ordinarily called with no arguments by \fIuuhosts\fP(1L), Xand will update \fBWHERE\fP, taking routes from \fBPATHS\fP and locations Xfrom \fBUUCPMAP/Index\fP (and possibly \fBNEWSMAP/Index\fP), if either X\fBPATHS\fP or \fBUUCPMAP/Index\fP is newer than \fBWHERE\fP. X.PP XInput file names may be specified as arguments. XThis also causes output to go to standard output instead of directly to XInput file name \fI-\fP is taken to be standard input. X\fBWHERE\fP. X.TP X\-\fBc X\fIUuwhere\fP uses a \fIdbm\fP(3) database to store the location information Xfrom \fBUUCPMAP/Index\fP before creating output. XThis option causes \fIuuwhere\fP to recreate the database regardless Xof the state of any input files. X.SH FILES X.TP XWHERE XThe place where the output of \fIuuwhere\fP is usually kept for use Xby \fIuuhosts\fP. X.TP XPATHS XThe default route list used as input by \fIuuwhere\fP. XProduced by \fIuuhosts\fP. X.TP XUUCPMAP/Index XThe source of the location information used by \fIuuwhere\fP. XProduced by \fIpathalias\fP. X.SH SEE ALSO Xuuhosts(1), pathalias(1), dbm(3). !RoNnIe!RaYgUn! echo x - Makefile sed -e 's/^X//' > Makefile << '!RoNnIe!RaYgUn!' X# @(#) Makefile 1.20 85/02/05 XSHELL=/bin/sh X X# BIN should be either /usr/local or /usr/local/bin XBIN=/usr/local XLIB=/usr/local/lib XPATHS=$(LIB)/nmail.paths X X# If you do not have dbm(3), i.e., -ldbm, set UUWHERE to nothing. X# UUWHERE=uuwhere XUUWHERE= XWHERE=$(LIB)/nmail.where X# TMP should be in the same directory as WHERE. XTMP=$(LIB)/nmail.tmp X# -ldbm DATABASE used by uuwhere. XDATABASE=$(LIB)/uuindex X X# Most of the news parameter files and mapsh are in this directory. XNEWS=$(LIB)/news X# The maps from mod.map.all are under this directory. XMAPS=$(NEWS)/maps X# USENET spool directory containing articles from newsgroup mod.map.news. XNEWSSPOOL=/usr/spool/news/mod/map/news X# USENET spool directory containing articles from newsgroup mod.map.uucp. XUUCPSPOOL=/usr/spool/news/mod/map/uucp X X# The filename of the manual entry. XUUHOSTSMAN=uuhosts.1 XUUWHEREMAN=uuwhere.1 XMAN=$(UUHOSTSMAN) $(UUWHEREMAN) XMANSOURCES=uuhosts.man uuwhere.man X# The manual directory for local entries. XMANDIR=/usr/man/manl X X# The rest of the Makefile shouldn't need to be changed. X XUUCPMAP=$(MAPS)/mod.map.uucp XNEWSMAP=$(MAPS)/mod.map.news X XSOURCES=uuhosts.sh mapsh.c uuwhere.c $(MANSOURCES) XALL= uuhosts mapsh $(UUWHERE) $(MAN) X Xall: $(ALL) X Xuuhosts: uuhosts.sh X cat uuhosts.sh \ X | sed -e 's%^UUCPSPOOL=.*$$%UUCPSPOOL=$(UUCPSPOOL)%;s%^NEWSSPOOL=.*$$%NEWSSPOOL=$(NEWSSPOOL)%' \ X | sed -e 's%^BIN=.*$$%BIN=$(BIN)%;s%^LIB=.*$$%LIB=$(LIB)%' \ X | sed -e 's%^PATHS=.*$$%PATHS=$(PATHS)%;s%^WHERE=.*$$%WHERE=$(WHERE)%'\ X | sed -e 's%^NEWS=.*$$%NEWS=$(NEWS)%;s%^MAPS=.*$$%MAPS=$(MAPS)%'\ X > uuhosts X chmod +x uuhosts X Xmapsh: mapsh.c X $(CC) -o mapsh -DMAPS=\"$(MAPS)\" mapsh.c X Xuuwhere: uuwhere.c X $(CC) -o uuwhere -DUUCPINDEX=\"$(UUCPMAP)/Index\" \ X -DNEWSINDEX=\"$(NEWSMAP)/Index\" \ X -DPATHS=\"$(PATHS)\" -DWHERE=\"$(WHERE)\" \ X -DTMP=\"$(TMP)\" -DDATABASE=\"$(DATABASE)\" \ X uuwhere.c -ldbm X Xwhere: $(LIB)/uuwhere X X$(UUHOSTSMAN): uuhosts.man X sed -e 's%NEWSMAP%$(NEWSMAP)%;s%UUCPMAP%$(UUCPMAP)%' uuhosts.man \ X | sed -e 's%BIN%$(BIN)%;s%LIB%$(LIB)%' \ X | sed -e 's%PATHS%$(PATHS)%;s%WHERE%$(WHERE)%;s%TMP%$(TMP)%'\ X | sed -e 's%DATABASE%$(DATABASE)%;s%NEWS%$(NEWS)%;s%MAPS%$(MAPS)%'\ X > $(UUHOSTSMAN) X X$(UUWHEREMAN): uuwhere.man X sed -e 's%NEWSMAP%$(NEWSMAP)%;s%UUCPMAP%$(UUCPMAP)%' uuwhere.man \ X | sed -e 's%BIN%$(BIN)%;s%LIB%$(LIB)%' \ X | sed -e 's%PATHS%$(PATHS)%;s%WHERE%$(WHERE)%;s%TMP%$(TMP)%'\ X | sed -e 's%DATABASE%$(DATABASE)%;s%NEWS%$(NEWS)%;s%MAPS%$(MAPS)%'\ X > $(UUWHEREMAN) X Xinst_: X Xinst_uuwhere: $(UUWHERE) X -rm -f $(LIB)/uuwhere X cp uuwhere $(LIB)/uuwhere X chmod 555 $(LIB)/uuwhere X -rm -f $(MANDIR)/$(UUWHEREMAN) X cp $(UUWHEREMAN) $(MANDIR) X chmod 444 $(MANDIR)/$(UUWHEREMAN) X Xinstall: $(ALL) inst_$(UUWHERE) X -rm -f $(BIN)/uuhosts X cp uuhosts $(BIN)/uuhosts X chmod 555 $(BIN)/uuhosts X -rm -f $(MANDIR)/$(UUHOSTSMAN) X cp $(UUHOSTSMAN) $(MANDIR) X chmod 444 $(MANDIR)/$(UUHOSTSMAN) X @echo "Rest of installation has to be done as root." X cp mapsh $(NEWS)/mapsh X -strip $(NEWS)/mapsh X chown root $(NEWS)/mapsh X chgrp news $(NEWS)/mapsh X chmod 4750 $(NEWS)/mapsh X ls -lg $(NEWS)/mapsh X @echo "If the following mkdir of $(MAPS) fails," X @echo "it is assumed that the map directories were set up previously." X mkdir $(MAPS) X mkdir $(MAPS)/bin $(MAPS)/tmp $(UUCPMAP) $(NEWSMAP) X chgrp news $(MAPS) $(MAPS)/* X chmod 555 $(MAPS) X chmod 775 $(UUCPMAP) $(NEWSMAP) X chmod 777 $(MAPS)/tmp X chmod 555 $(MAPS)/bin X cp /bin/cat $(MAPS)/bin X cp /bin/echo $(MAPS)/bin X cp /bin/sed $(MAPS)/bin X cp /bin/sh $(MAPS)/bin X -strip $(MAPS)/bin/* X chgrp news $(MAPS)/bin/* X chmod 555 $(MAPS)/bin/* X @echo '' X @echo 'This is what the things just installed *should* look like:' X @echo '$(MAPS): total 16' X @echo 'dr-xr-xr-x 6 root news 512 Nov 11 16:42 .' X @echo 'drwxrwxr-x 19 news news 1024 Nov 11 16:45 ..' X @echo 'dr-xr-xr-x 2 root news 512 Nov 11 16:39 bin' X @echo 'drwxrwxr-x 2 news news 2048 Nov 11 16:42 mod.map.news' X @echo 'drwxrwxr-x 2 news news 10240 Nov 11 16:39 mod.map.uucp' X @echo 'drwxrwxrwx 2 news news 24 Nov 11 16:41 tmp' X @echo '' X @echo '$(MAPS)/bin: total 59' X @echo '-r-xr-xr-x 1 root news 10240 Nov 11 15:29 cat' X @echo '-r-xr-xr-x 1 root news 4096 Nov 11 16:33 echo' X @echo '-r-xr-xr-x 1 root news 18432 Nov 11 15:29 sed' X @echo '-r-xr-xr-x 1 root news 27648 Nov 11 15:29 sh' X @echo '' X @echo 'And here is what they actually *do* look like:' X ls -lga $(MAPS) X ls -lga $(MAPS)/bin X Xclean: X rm -f $(ALL) X rm -f *.pag *.dir X rm -f *.o X rm -f *.shar X Xshar: X shar README* $(SOURCES) Makefile > uuhosts.shar !RoNnIe!RaYgUn! exit -- John Quarterman, CS Dept., University of Texas, Austin, Texas 78712 USA jsq@ut-sally.ARPA, jsq@ut-sally.UUCP, {ihnp4,seismo,ctvax}!ut-sally!jsq