newer uuhosts (too many changes for diff listings)

sources-request at panda.UUCP sources-request at panda.UUCP
Wed Sep 11 00:19:24 AEST 1985


Mod.sources:  Volume 3, Issue 11
Submitted by: ihnp4!ut-sally!im4u!jsq at tzec.UTEXAS.EDU (John Quarterman)

: 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
XThis posting of uuhosts works with the latest (August 1985)
Xmod.map.uucp postings.  Peculiar failures which I have not been able
Xto reproduce here have been reported from some systems running some
Xports of System V.  Please let me know of any problems, such as
Xuuhosts not recognizing articles in mod.map.uucp as valid,
Xand mailing them to postmaster rather than extracting them.
X
XThis version of uuhosts, 1.58, does map extraction quite differently
Xfrom the previous version, 1.52.  Rather than immediately extracting
Xeach article when it arrives, a list is kept of the pathnames of
Xincoming articles, and "uuhosts -unbatch" is called nightly to do the
Xextraction.  --->  It is necessary to completely reinstall uuhosts <---
Xusing the new installation instructions.
X
XOutput paging by means of more, pg, etc. has been added, due to popular
Xdemand.  A default pager must be set in the Makefile.  If the compile-time
Xparameters get much more complicated, I will probably pick up Larry Wall's
Xconfiguration package.
X
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 or other parameters which are incorrect for your
Xsystem.  Then do "make" to be sure everything compiles correctly.
XTo install the necessary shell script, C program, and manual entry,
Xas well as creating all necessary new directories, do "make install"
Xas root.
X
XOnce the program is installed, you will want to extract any existing
Xmod.map.uucp articles so uuhosts can display their information.  To do
Xthis, type "uuhosts -setup &".  Do not do it as root!  Do it as some
Xuser in group news.  It will take a while:  display speed has been
Xbought by slowness in extraction.  You should only ever need to do
Xthis once, because of the last installation steps:
X
XFinally, modify NEWS/sys by hand so that inews will batch incoming
Xmod.map.uucp articles, and also arrange for "uuhosts -unbatch" to
Xbe called nightly by cron.  See the MAINTENANCE section of the uuhosts
Xmanual entry for how to do this.  Do not call "uuhosts -unbatch" as root!
XHave it called as some user in group news.
X
X
XPathalias is not included here:  it was posted to net.sources recently.
XIf you have uupath, you may want to use it to look up UUCP routing
Xinformation 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				John Quarterman
X				Department of Computer Sciences
X				University of Texas at Austin
X				Austin, Texas 78712 USA
X				jsq at sally.utexas.edu (jsq at ut-sally.ARPA)
X				{ihnp4,seismo,gatech,harvard,ctvax}!ut-sally!jsq
X
XHere is an example of the most common use of uuhosts, which is to
Xdisplay information about a particular host:
X
Xsally% uuhosts bang
XUUCP mail path for bang:
Xbang	ihnp4!bang!%s
XUUCP mail path for bang annotated by location:
Xbang(usa.ca.s)	ihnp4(att.il)!bang(usa.ca.s)!%s
X
XUUCP mail information for host bang (#USENET lines show USENET news links):
X#Name		      bang
X#System-CPU-OS	      Model 16B - Xenix
X#Organization	      Bang World Communications
X#Contact	      Bret Marquis
X#Electronic-Address      {ihnp4, sdcsvax}!bang!bam
X#Telephone	      (619) 450-2110
X#Postal-Address	      La Jolla, CA
X#Latitude-Longitude	32 51 N / 117 16 W city 
X#Remarks	
X#Written-by	      web 4/28/85, web 4/6/85, web per bam 3/28/85
X#USENET	sys1 futura
X#
Xbang    blia(EVENING), cbosgd(DEMAND), celerity(DIRECT), crash(DIRECT),
X	epicom(WEEKLY), futura(WEEKLY), ihnp4(DEMAND), netword(EVENING), 
X	noscvax(DIRECT), orca(DEMAND), sdchema(DIRECT), sdcsvax(DIRECT),
X	sdhubbs(WEEKLY), sys1(DEMAND), systech(DAILY), telesoft(DIRECT),
X	vis(DEMAND), westsci(DAILY), wolf(DIRECT)
X
!RoNnIe!RaYgUn!
echo x - uuhosts.sh
sed -e 's/^X//' > uuhosts.sh << '!RoNnIe!RaYgUn!'
X#!/bin/sh
X# '@(#) uuhosts.sh 1.58 85/09/03'
X# uuhosts - UUCP mail and USENET news information
X
XDEFPAGER=cat
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
Xpager="${PAGER-$DEFPAGER}"
X
Xcd $NEWS
X
Xcase $1 in
X	-setup)
X		# Initial setup.  Should only need to be done once.
X		ls $UUCPSPOOL/* > $MAPS/$UUCPMAP/Batch
X		exec $BIN/uuhosts -unbatch
X		exit 1
X	;;
X
X	-unbatch)
X		# Unbatch map articles batched by sys.  Called from cron.
X		cd $MAPS/$UUCPMAP
X		if [ -f Batch ]; then
X			:
X		else
X			exit 0
X		fi
X		mv Batch Batch.working
X		for f in `cat Batch.working`
X		do
X			$BIN/uuhosts -x < $f
X			sleep 60
X		done
X		rm Batch.working
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 postmaster' > $tempcomm
X		echo 'Reply-To: postmaster' > $temphead
X		awk '
XBEGIN	{
X	temphead = "'$temphead'"; tempcomm = "'$tempcomm'";
X	isuucpmap = 0;
X	shead = 0; stext = 1; suucp = 2;
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}
X# Assume we were called on the right newsgroup.
X#state == shead && $1 == "Newsgroups:" {	# no cross-postings allowed
X#	if ($2 == "'$UUCPMAPGROUP'")
X#		isuucpmap = 1;
X#}
Xstate == shead && $1 == "Subject:" {
X	# the odd initial test is to avoid certain brain damaged awks
X	if ("X" ~ /X/ \
X	&& $2 !~ /^UUCP/ && $2 !~ /^uucp/ && $2 !~ /^Uucp/) {
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'" | "'$MAPSH'";
X		state = suucp;
X	} else
X		state = stext;
X}
Xstate == shead {
X		print $0 >> temphead;
X}
Xstate == suucp	{
X	print | "'$MAPSH'";
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	-i)
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}
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}
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 $pager $*
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' * | $pager
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 news 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 | $pager
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) or "uuhosts -r README" 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.11 85/09/04";
X#endif
X/*
X * uuwhere:
X * This is a frill which may be called by uuhosts to annotate routing
X * information produced by pathalias(1L) with the location of each host.
X * It takes the ASCII UUCP routing database PATHS on standard input,
X * and produces the annnotated version on standard output, to be put
X * in WHERE.  It gets the location information from the UUCP map directory
X * produced by uuhosts from the map posted to the USENET newsgroup
X * mod.map.uucp by the UUCP Project.
X *
X * Uuwhere is usually called by uuhosts, and most of the time just
X * checks to see if WHERE needs to be updated.  Uuhosts itself
X * displays the annotated routing information to the user.
X *
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 * If you don't have dbm, this won't work.
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 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	if (!flaginput) {
X		(void)fclose(stdout);
X		(void)fclose(stdin);
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(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; 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/09/03
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.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 (usually geographical) region.
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.PP
XOutput is broken into pages by the program named in the PAGER environment
Xvariable, or by a default pager set at compile time,
Xwhich is usually one of more, pg, or cat,
Xas appropriate for the host system.
X.SH MAINTENANCE
XNone of these options should be used by the super-user (root).
X.TP
Xuuhosts \-setup
XOnce "make\ install" has been done for the initial installation,
Xthis option may be used to extract any backlog of \fBmod.map.uucp\fP articles.
XDo not run it as root!
XRun it as some user in group news.
X.TP
Xmaps:mod.map.uucp:F:MAPS/mod.map.uucp/Batch
XThis line should go in \fBNEWS/sys\fP.
XIt causes \fIinews\fP(1L) to list the pathnames of incoming articles of
X\fBmod.map.uucp\fP in the \fBBatch\fP file.
X.TP
Xuuhosts \-unbatch
XThis should be called nightly by \fIcron\fP(8) or whatever mechanism is
Xused to call the USENET \fIexpire\fP(8) command.
XIt extracts articles from \fBmod.map.uucp\fP which have
Xcome in since the last time it was run.
XDo not run it as root!
XRun it as some user in group news.
X.TP
Xuuhosts \-x
XExtract an individual \fBmod.map.uucp\fP article.
XOrdinarily called from \fIuuhosts\fP\ \-\fBunbatch\fP.
X.TP
Xuuhosts \-i
XRebuild the Index file (see below).
XOrdinarily called from \fIuuhosts\fP\ \-\fBunbatch\fP.
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 \fBpostmaster\fP, 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.
X.SH SEE ALSO
Xvnews(1), readnews(1), mail(1), sendmail(8), look(1)
!RoNnIe!RaYgUn!
echo x - uuwhere.man
sed -e 's/^X//' > uuwhere.man << '!RoNnIe!RaYgUn!'
X.TH UUW\HERE 1L 85/08/11
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, if either
X\fBPATHS\fP or \fBUUCPMAP/Index\fP is newer than \fBWHERE\fP.
XThe information in \fBWHERE\fP is displayed by \fIuuhosts\fP itself.
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.25 85/09/03
XSHELL=/bin/sh
X
X# Settable parameters.
X
X# Default pager for use if PAGER environment variable is not set.
XDEFPAGER=more	# BSD systems
X#DEFPAGER=pg	# AT&T systems
X#DEFPAGER=cat	# systems with paging in the kernel
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.
X# (Another good place to put it is MAPS=/usr/spool/news/maps.)
XMAPS=$(NEWS)/maps
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
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%^DEFPAGER=.*$$%DEFPAGER=$(DEFPAGER)%' \
X	| sed -e 's%^UUCPSPOOL=.*$$%UUCPSPOOL=$(UUCPSPOOL)%' \
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			-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%UUCPMAP%$(UUCPMAP)%' uuhosts.man \
X	| sed -e 's%DEFPAGER%$(DEFPAGER)%;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%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	cp /dev/null $(WHERE)
X	-chmod 666 $(WHERE)
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)
X	chgrp news $(MAPS) $(MAPS)/*
X	chmod 555 $(MAPS)
X	chmod 775 $(UUCPMAP)
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        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



More information about the Mod.sources mailing list