home *** CD-ROM | disk | FTP | other *** search
- From: harvard!ut-sally!jsq (John Quarterman)
- Subject: uuhosts (updated)
- Newsgroups: mod.sources
- Approved: john@genrad.UUCP
-
- Mod.sources: Volume 2, Issue 15
- Submitted by: harvard!ut-sally!jsq (John Quarterman)
-
- Since the format of mod.map.uucp was changed recently (again), and
- mod.map.news has been dropped, I've updated uuhosts to reflect that.
- This posting of uuhosts works with the latest (June 1985) mod.map.uucp
- postings.
-
- : 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
- XUUCP mail and USENET news information previously extracted from the
- XUSENET newsgroup mod.map.uucp. Mail routing information as produced by
- Xpathalias is also displayed. Since uuhosts needs the map information
- Xfrom the USENET spool directory for mod.map.uucp extracted into a more
- Xaccessible (and permanent) location, it can be used 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.uucp 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.uucp 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.uucp articles that arrive later should be extracted
- Xautomatically because of the NEWS/sys entry.
- X
- X
- XThis posting of uuhosts works with the latest (June 1985)
- Xmod.map.uucp 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.uucp 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 seismo
- XUUCP mail path for seismo:
- Xseismo seismo!%s
- XUUCP mail path for seismo annotated by location:
- Xseismo(usa.va) seismo(usa.va)!%s
- X
- XUUCP mail information for host seismo (#USENET lines show USENET links):
- X#Name seismo
- X#System-CPU-OS Vax 11/780, 4.2BSD
- X#Organization Center for Seismic Studies
- X#Contact Rick Adams
- X#Electronic-Address seismo!postmaster
- X#Telephone (703) 276-7900
- X#Postal-Address 1300 N. 17th St., Suite 1450, Arlington, VA 22209
- X#Latitude-Longitude 38 53 30 N / 77 03 30 W
- X#Remarks A.k.a seismo.ARPA
- X#Written-by Rick Adams 5/15/85
- X#USENET brl-vgr columbia cmcl2 harvard hao lognet2 trwatf rochester sri-iu
- X#USENET ut-sally umcp-cs uwvax presby utah-cs mcvax munnari kaist
- X#
- X# 10Mb Pronet
- XCSS-RING = {seismo, hugo, janus, sdccis, css-sun}(LOCAL)
- X
- X# local calls
- Xseismo andi(DIRECT), bdmrrr(DIRECT), cal-unix(DIRECT),
- X damanet(DIRECT), dolqci(DIRECT), elsie(DIRECT), gl-red(DIRECT),
- X gl-blue(DIRECT), grendel(DIRECT), hadron(DIRECT), nbs-amrf(DIRECT),
- X neurad(DIRECT), netword(DIRECT), prcrs(DIRECT), prometheus(DIRECT),
- X rlgvax(DIRECT), trwatf(DIRECT), vrdxhq(DIRECT), wuhep(DIRECT)
- X
- X# these are in LaJolla, CA, but we have a leased line, so treat them as local
- Xseismo kobold(DIRECT), s3sun(DIRECT)
- X
- X# long distance
- Xseismo allegra(DEMAND), bellcore(DEMAND), brl-bmd(DEMAND), cbosgd(DEMAND-1),
- X decvax(DEMAND), dual(DEMAND), gatech(DEMAND), hao(DEMAND),
- X harpo(DEMAND), ihnp4(DEMAND+HIGH), lamont(DEMAND), mcnc(DEMAND),
- X mit-erl(DEMAND), nsc(DEMAND), noao(DEMAND),
- X philabs(DEMAND), prcrs(EVENING), presby(DEMAND), princeton(DEMAND),
- X raisun(POLLED), rna(DEMAND), scgvaxd(DEMAND),
- X sun(DEMAND), turtlevax(DEMAND), ucadmus(DEMAND),
- X ulysses(DEMAND), unr70(DEMAND), usna(DEMAND), uw70(DEMAND),
- X vortex(DEMAND), whuxlk(DEMAND), wucs(DEMAND), zehntel(DEMAND)
- X
- X# X.25 gateway to the world....
- Xseismo mcvax(DEMAND), prlb2(DEMAND+1), munnari(DAILY/5), kaist(DAILY/2),
- X ukc(DEAD)
- X
- Xseismo ut-sally(DEDICATED), rochester(DEDICATED), cmcl2(DEDICATED),
- X nta-vax(DEDICATED), lbl-csam(DEDICATED), harvard(DEDICATED),
- X sri-iu(DEDICATED), uwvax(DEDICATED), utah-cs(DEDICATED),
- X umcp-cs(DEDICATED), mordor(DEDICATED), topaz(DEDICATED),
- X tardis(DEDICATED+1), columbia(DEDICATED), lognet2(DEDICATED),
- X cvl(DEDICATED), think(DEDICATED+1)
- X
- X# These sites are on the arpanet and don't speak uucp. However, the news
- X# software makes it look like they talk uucp, so seismo fakes it for them
- Xseismo brl-tgr(DEDICATED), brl-vgr(DEDICATED), brl-vld(DEDICATED),
- X nlm-mcs(DEDICATED), nlm-vax(DEDICATED), cmu-cs-k(DEDICATED),
- X cmu-cs-p(DEDICATED)
- X
- X# We can not reliably connect to these sites, but we do get through on occasion
- Xseismo uf-cgrl(WEEKLY), duke(WEEKLY)
- X
- X# We poll these sites even if we don't have traffic for them
- Xmcnc seismo(DAILY/2)
- Xuw70 seismo(DAILY)
- Xhadron seismo(DAILY/2)
- Xvortex seismo(DAILY/4)
- Xgrendel seismo(DAILY/4)
- Xprcrs seismo(DAILY)
- X
- !RoNnIe!RaYgUn!
- echo x - uuhosts.sh
- sed -e 's/^X//' > uuhosts.sh << '!RoNnIe!RaYgUn!'
- X#!/bin/sh
- X# '@(#) uuhosts.sh 1.52 85/06/07'
- X# uuhosts - UUCP mail and USENET news information
- X
- XBIN=/usr/local
- XLIB=/usr/local/lib
- XNEWS=$LIB/news
- XMAPS=$NEWS/maps
- XUUCPMAPGROUP=mod.map.uucp
- XUUCPMAP=$UUCPMAPGROUP
- XMAPSH=$NEWS/mapsh
- 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 directory $MAPS/$UUCPMAP contains the UUCP and USENET map
- X# information extracted from the newsgroup mod.map.uucp.
- X# The extraction is done by 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.uucp; 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 $UUCPSPOOL
- X for f in *
- X do
- X $BIN/uuhosts -x < $f
- X sleep 30
- X done
- X DONTINDEX=0
- X exec $BIN/uuhosts -i
- X exit 1
- 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 == "'$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 (($2 !~ /^UUCP/ && $2 !~ /^uucp/ && $2 !~ /^Uucp/) \
- X || !typeset) { # this requires Newsgroups: before Subject:
- X print "Subject: not a map update" >> temphead;
- X print "Original-" $0 >> temphead;
- X isuucpmap = 0;
- X } else
- X print $0 >> temphead;
- X next;
- X}
- Xstate == shead && /^$/ {
- X if (isuucpmap != 0) {
- X print "PATH=/bin; umask 0002; cd '$UUCPMAP'" | "'$BIN'/uuhosts -ux";
- X state = suucp;
- X } else
- X state = stext;
- X}
- Xstate == shead {
- X print $0 >> temphead;
- X}
- Xstate == suucp {
- X print | "'$BIN'/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 -nx)
- X exec $BIN/uuhosts -ux
- X exit 1
- X ;;
- X
- X -ux)
- X # extract a map piece
- X $MAPSH
- X exec $BIN/uuhosts -i
- X exit 0
- X ;;
- X
- X -ui)
- X exec $BIN/uuhosts -i
- X exit 1
- X ;;
- X
- X -ni)
- X exec $BIN/uuhosts -i
- X exit 1
- X ;;
- X
- X
- X -i)
- X case $DONTINDEX in
- X 1)
- X exit 0
- X ;;
- X esac
- X cd $MAPS/$UUCPMAP
- X hostmarker="#N"
- 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 -r)
- X # by region
- X cd $MAPS/$UUCPMAP
- X shift
- X case $# in
- X 0)
- X exec ls
- X exit 1
- X ;;
- X esac
- X exec cat $*
- X exit 1
- X ;;
- X
- X -u)
- X exec $BIN/uuhosts -r
- X exit 1
- X ;;
- X
- X -n)
- X exec $BIN/uuhosts -r
- X exit 1
- X ;;
- X
- X -k)
- X # by keyword
- X cd $MAPS/$UUCPMAP
- X shift
- X exec awk '
- XBEGIN { inside = 1; outside = 0; state = outside; }
- X/^#N/ && state == inside {
- X if (useit == 1) {
- X for (i = 0; i < count; i++) {
- X print block[i];
- X }
- X }
- X state = outside;
- X}
- X/^#N/ { state = inside; count = 0; useit = 0; }
- Xstate == inside { block[count++] = $0; }
- X/'"$*"'/ { useit = 1; }
- XEND {
- X if (useit == 1) {
- X for (i = 0; i < count; i++) {
- X print block[i];
- X }
- X }
- 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 information for host '$arg' (#USENET lines show USENET links):'
- 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 /
- Xs/^#U/#USENET /'
- 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' -r region
- Xfor information about hosts in a region of the UUCP or USENET networks, or
- X
- X 'uuhosts' -r
- Xfor a list of known regions.
- X
- XSee uuhosts(1) for further details.
- 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/06/07
- X.SH NAME
- Xuuhosts \- UUCP mail and USENET news information.
- X.SH SYNOPSIS
- X.B
- Xuuhosts
- Xhostname ...
- X.br
- X.B
- Xuuhosts
- X-r [ region ]
- X.br
- X.B
- Xuuhosts
- X-x
- X.br
- X.B
- Xuuhosts
- X-i
- 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 map information.
- XThe USENET map is carried as notations in entries in the UUCP map,
- Xin the lines starting with ``#USENET''.
- 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 \-r \fIregion\fP
- Xfor information about hosts in a region (usually geographical) networks.
- X.TP
- Xuuhosts \-r README
- Xgets an introduction to the map.
- X.TP
- Xuuhosts \-r Local
- Xgets map information known only locally.
- X.TP
- Xuuhosts \-r
- Xfor a list of known regions.
- 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 map from a 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
- XUUCPMAP
- XUUCP and USENET map 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
- 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.uucparticle arrives,
- Xand may be manually forced by ``uuhosts\ \-i''.
- 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 two at a time.
- 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.
- XIt is possible to disable indexing for a given uuhosts\ \-x call
- Xby doing ``DONTINDEX=1;\ export\ DONTINDEX'' (or ``setenv\ DONTINDEX\ 1''
- Xin csh) before the uuhosts call.
- 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.21 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.
- XUUWHERE=uuwhere
- X# UUWHERE=
- 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
-
-