Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ut-sally.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!uw-beaver!tektronix!hplabs!hao!cires!nbires!ut-sally!jsq From: jsq@ut-sally.UUCP Newsgroups: net.sources Subject: uuhosts Message-ID: <2976@ut-sally.UUCP> Date: Mon, 6-Aug-84 17:15:13 EDT Article-I.D.: ut-sally.2976 Posted: Mon Aug 6 17:15:13 1984 Date-Received: Sun, 12-Aug-84 01:32:33 EDT Organization: U. Texas CS Dept., Austin, Texas Lines: 249 The bulk of this article is a shar archive that contains a man page and the Bourne shell source for uuhosts. Uuhosts is mostly used to look up UUCP mail paths and USENET news site information, but also knows how to extract such information from net.news.map and put it in appropriate directories. It recognizes both the USENET news map information from cbosgd!map and also the UUCP mail map information in the format just posted by seismo!rick. Of course you still need to run pathalias on the mail map after you extract the whole map. Some pathnames in shell variables may need to be adjusted to local system configurations, but uuhosts should run on most any Version 7 or later Unix system. : This is a shar archive. Extract with sh, not csh. echo x - uuhosts.1 sed -e 's/^X//' > uuhosts.1 << '!Funky!Stuff!' X.TH UUHOSTS 1L 84/08/04 X.SH NAME Xuuhosts \- USENET news and UUCP mail information. X.SH SYNOPSIS X.B Xuuhosts Xhostname ... X.br X.B Xuuhosts X-g geographical-region X.br X.B Xuuhosts X-k keyword X.br X.B Xuuhosts X-g 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 USENET news site 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 -g \fIgeographical-region\fP Xfor information about USENET news hosts in a geographical region. X.TP Xuuhosts -g README Xgets an introduction to the USENET news map. X.TP Xuuhosts -g Local Xgets USENET news information known only locally. X.TP Xuuhosts -g Xfor a list of known USENET geographical-regions. X.TP Xuuhosts -k \fIkeyword\fP Xfor a list of known USENET sites whose entries contain the word \fIkeyword\fP. 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 net.news.map article. X.PP XThis should be called automatically by a line in \fB/usr/local/lib/news/sys\fP Xlike X.IP Xnewsmap:net.news.map:B:/usr/local/uuhosts -x X.SH FILES X.TP X/usr/local/lib/nmail.paths 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) X.TP X/usr/local/lib/news/net.news.map XUSENET news site information taken from newsgroup \fBnet.news.map\fP X(thanks to \fBcbosgd!map\fP). X.TP X/usr/local/lib/news/net.mail.map XUUCP mail site information taken from newsgroup \fBnet.news.map\fP X(thanks to the UUCP mapping project). X.TP X/usr/local/lib/news/sys XContains arrangements to call "uuhosts -x". X.SH SEE ALSO Xvnews(1), readnews(1), mail(1), sendmail(8) !Funky!Stuff! echo x - uuhosts sed -e 's/^X//' > uuhosts << '!Funky!Stuff!' X#!/bin/sh X# '@(#) uuhosts.sh 1.17 84/08/04' X X# PATH will have to be adjusted for non-BSD systems. XPATH=/usr/local:/usr/ucb:/bin:/usr/bin XLIB=/usr/local/lib X X# Routing information produced by pathalias. Xpaths=$LIB/nmail.paths X X# The directory $NEWSMAP should contain the USENET news map information X# from newsgroup net.news.map that is posted about once a month from X# cbosgd!map, extracted by a line like this in $LIB/news/sys: X# X# newsmap:net.news.map:B:/usr/local/uuhosts -x X# X# Locally-known information should go in $LIB/news/net.news.map/Local. X# The directory $MAILMAP is extracted by the same command from the X# UUCP mail information posted to the same newsgroup. XNEWSMAP=$LIB/news/net.news.map XMAILMAP=$LIB/news/net.mail.map Xcd $NEWSMAP X Xcase $1 in X -x) X # extract a new map piece into the map directory X temphead=/tmp/maphead.$$ X temptext=/tmp/maptext.$$ X awk ' XBEGIN { X temphead = "'$temphead'"; X isnewsmap = 0; ismailmap = 0; X shead = 0; stext = 1; state = shead; X print "Reply-To: usenet" >> temphead; X} Xstate == shead && /^From: / { X print "Original-" $0 >> temphead; X} Xstate == shead && /^Subject: / { X if ($2 != "Re:") X for (x = 2; x <= NF; x++) { X if ($x == "UUCPmap") { X ismailmap = 1; X break; X } X if ($x == "map") { X if (x <= 2) X continue; X x--; X if ($x == "USENET") { X isnewsmap = 1; X break; X } X if ($x == "UUCP") { X ismailmap = 1; X break; X } X x++; X } X } X if (!isnewsmap && !ismailmap) { X print "Subject: not a map update" >> temphead; X print "Original-" $0 >> temphead; X } else X print $0 >> temphead; X} Xstate == shead && /^$/ { state = stext; } Xstate == stext { X if (isnewsmap != 0) X print | "/bin/sh"; X else if (ismailmap != 0) X print | "cd '$MAILMAP'; /bin/sh; ar xv uucpmap.*.ar"; X else X print; X} X' > $temptext 2>&1 X cat $temphead $temptext | /bin/mail usenet X rm -f $temphead $temptext X exit 0 X ;; X X -g) X # by geographical region X shift X if test $# -eq 0 X then X exec ls X exit 1 X fi X exec cat $* X exit 1 X ;; X X -k) X # by keyword 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 site name X for arg in $* X do X echo 'UUCP mail path:' X grep '^'${arg} $paths X echo ' XUSENET news site information:' X sed -n -e "/^Name:[ ]*${arg}/,/^$/p" * 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' -g geographical-region Xfor information about USENET news sites in a geographical region, or X X 'uuhosts' -g Xfor a list of known USENET geographical-regions. X' Xexit 1 !Funky!Stuff! -- 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