Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!ut-sally!jsq From: jsq@ut-sally.UUCP (John Quarterman) Newsgroups: net.sources.bugs Subject: Re: uuhosts: extract and display mod.map.all Message-ID: <587@ut-sally.UUCP> Date: Mon, 7-Jan-85 10:07:21 EST Article-I.D.: ut-sally.587 Posted: Mon Jan 7 10:07:21 1985 Date-Received: Wed, 9-Jan-85 03:03:31 EST References: <500@ut-sally.UUCP> Distribution: net Organization: U. Texas CS Dept., Austin, Texas Lines: 370 # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by ut-sally!jsq on Sat Jan 5 14:41:10 CST 1985 # Contents: README.2 uucpnews.sh patches echo x - README.2 sed 's/^@//' > "README.2" <<'@//E*O*F README.2//' This is a fix for my previous posting of uuhosts. It contains a very minor fix to the display part of uuhosts.sh, addition of some chmod commands to Makefile, and uucpnews.sh to replace uucp.from.news.sh, together with the appropriate changes to Makefile. Uucpnews is a hack to fill out the UUCP map information from mod.map.uucp with information from mod.map.news so that pathalias can produce a usable routing database. When this article is run through sh, it will first extract the files README.2 and uucpnews.sh, then it will attempt to use Larry Wall's patch program to modify uuhosts.sh and Makefile. If you don't have patch, you can make the changes by hand. @//E*O*F README.2// chmod u=rw,g=r,o=r README.2 echo x - uucpnews.sh sed 's/^@//' > "uucpnews.sh" <<'@//E*O*F uucpnews.sh//' #!/bin/sh # # This command, uucpnews, is a stopgap measure for use until # the UUCP map is complete. It extracts mail information from the # USENET news map and uses it to fill in gaps in the UUCP mail map. # # With no arguments, uucpnews changes to the news map directory, # $MAPS/$NEWSMAP, and uses all the files there as input. # (Alternatively, a list of file names may be given as arguments.) # # It looks through the news map entries for ones with mail information, # extracts those into individual files in $DIR by host name, and later # copies all those for which there are not already host entries in # the mail map directory to the mail map directory, $MAPS/UUCPMAP. # The new mail map files all have '-' appended so they can be easily # distinguished. If uucpnews is run again, such $MAPS/UUCPMAP/*- # entries will be overwritten. # # The temporary directory $DIR is removed after the command is done. # PATH=/usr/local:/usr/ucb:/bin:/usr/bin umask 0002 LIB=/usr/local/lib NEWS=$LIB/news MAPS=$NEWS/maps NEWSMAPGROUP=mod.map.news UUCPMAPGROUP=mod.map.uucp NEWSMAP=$NEWSMAPGROUP UUCPMAP=$UUCPMAPGROUP DIR=uucptmp if [ $1x = x ]; then cd $MAPS/$NEWSMAP args=* else args=$* fi mkdir $DIR awk ' BEGIN { sbetween = 0; sinside = 1; state = sbetween; Date = "'"`date`"'"; split (Date, date, " "); Mark = "uucpnews " date[3] " " date[2] " " date[6]; dir = "'$DIR'"; } state == sbetween && $1 == "Name:" { state = sinside; last = ""; Name = ""; System = ""; Organization = ""; Contact = ""; Telephone = ""; Postal = ""; Address = ""; News = ""; Mail = ""; Latlong = ""; Remarks = ""; Written = ""; Comments = ""; } state != sinside { next; } # { print $0; } $1 == "Name:" { Name = $2; next; } $1 == "Organization:" { Organization = $2; for (x = 3; x <= NF; x++) Organization = Organization " " $x; last = $1; next; } $1 == "Contact:" { Contact = $2; for (x = 3; x <= NF; x++) Contact = Contact " " $x; last = $1; next; } $1 == "Phone:" { Telephone = $2; for (x = 3; x <= NF; x++) Telephone = Telephone " " $x; last = $1; next; } $1 == "Postal-Address:" { Postal = $2; for (x = 3; x <= NF; x++) Postal = Postal " " $x; last = $1; next; } $1 == "Electronic-Address:" { Address = $2; for (x = 3; x <= NF; x++) Address = Address " " $x; last = $1; next; } $1 == "News:" { News = $2; for (x = 3; x <= NF; x++) News = News " " $x; last = $1; next; } (/^ / || /^ /) && last == "News:" { for (x = 1; x <= NF; x++) News = News " " $x; next; } $1 == "Mail:" { Mail = $2; for (x = 3; x <= NF; x++) Mail = Mail " " $x; last = $1; next; } (/^ / || /^ /) && last == "Mail:" { for (x = 1; x <= NF; x++) Mail = Mail " " $x; next; } $1 == "Comments:" { last = $1; if ($2 == "last" && $3 == "edited") { Written = $4; for (x = 5; x <= NF; x++) Written = Written " " $x; next; } Comments = $2; for (x = 3; x <= NF; x++) Comments = Comments " " $x; next; } /^$/ { state = sbetween; if (Mail == "") Mail = News; if (Mail == "") next; output = dir "/" Name; printf ("echo x - %s\n", output); printf ("cat > %s << '\''End-of-%s'\''\n", output, output); printf ("#N\t%s\n", Name); printf ("#S\t%s\n", System); printf ("#O\t%s\n", Organization); printf ("#C\t%s\n", Contact); printf ("#E\t%s\n", Address); printf ("#T\t%s\n", Telephone); printf ("#P\t%s\n", Postal); printf ("#L\t%s\n", Latlong); printf ("#R\t%s\n", Mark); # split (News, news, ""); # printf ("#R\tNews: %s", news[1]); # for (x = 2; news[x] != ""; x++) { # if ((x % 8) == 0) # printf ("\n\t"); # else # printf (", "); # printf ("%s", news[x]); # } # printf ("\n"); printf ("#W\t%s\n", Written); printf ("#\n"); split (Mail, mail, " "); printf ("%s\t%s", Name, mail[1]); for (x = 2; mail[x] != ""; x++) { if ((x % 8) == 0) printf ("\n\t"); else printf (", "); printf ("%s", mail[x]); } printf ("\n"); if (Comments != "") { printf ("#\n"); printf ("#%s\n", Comments); } printf ("\n"); printf ("End-of-%s\n", output); next; } ' $args | sh cd $DIR for f in * do there=$MAPS/$UUCPMAP/$f if [ -r ${there} ]; then echo ${there} continue fi if [ -r ${there}. ]; then echo ${there}. continue fi if [ -r ${there}% ]; then echo ${there}% continue fi # if [ -r ${there}- ]; then # echo ${there}- # continue # fi echo new ${there}- mv $f ${there}- done cd .. rm -rf $DIR @//E*O*F uucpnews.sh// chmod u=r,g=r,o=r uucpnews.sh echo x - j/z patch <<'@//E*O*F patches/' diff -c -r ./Makefile ../Makefile *** ./Makefile Sat Jan 5 14:28:49 1985 --- ../Makefile Mon Dec 17 06:31:20 1984 *************** *** 7,14 # The maps from mod.map.all are under this directory. MAPS=$(NEWS)/maps ! SOURCES=uuhosts.sh mapsh.c uucp.from.news.sh ! ALL=uuhosts mapsh uucp.from.news all: $(ALL) --- 7,14 ----- # The maps from mod.map.all are under this directory. MAPS=$(NEWS)/maps ! SOURCES=uuhosts.sh mapsh.c uucpnews.sh ! ALL=uuhosts mapsh uucpnews all: $(ALL) *************** *** 16,21 sed -e \ 's%^LIB=.*$$%LIB=$(LIB)%;s%^NEWS=.*$$%NEWS=$(NEWS)%;s%^MAPS=.*$$%MAPS=$(MAPS)%'\ uuhosts.sh > uuhosts mapsh: mapsh.c $(CC) -o mapsh -DMAPS=\"$(MAPS)\" mapsh.c --- 16,22 ----- sed -e \ 's%^LIB=.*$$%LIB=$(LIB)%;s%^NEWS=.*$$%NEWS=$(NEWS)%;s%^MAPS=.*$$%MAPS=$(MAPS)%'\ uuhosts.sh > uuhosts + chmod +x uuhosts mapsh: mapsh.c $(CC) -o mapsh -DMAPS=\"$(MAPS)\" mapsh.c *************** *** 20,26 mapsh: mapsh.c $(CC) -o mapsh -DMAPS=\"$(MAPS)\" mapsh.c ! uucp.from.news: uucp.from.news.sh sed -e \ 's%^LIB=.*$$%LIB=$(LIB)%;s%^NEWS=.*$$%NEWS=$(NEWS)%;s%^MAPS=.*$$%MAPS=$(MAPS)%'\ uucp.from.news.sh > uucp.from.news --- 21,27 ----- mapsh: mapsh.c $(CC) -o mapsh -DMAPS=\"$(MAPS)\" mapsh.c ! uucpnews: uucpnews.sh sed -e \ 's%^LIB=.*$$%LIB=$(LIB)%;s%^NEWS=.*$$%NEWS=$(NEWS)%;s%^MAPS=.*$$%MAPS=$(MAPS)%'\ uucpnews.sh > uucpnews *************** *** 23,29 uucp.from.news: uucp.from.news.sh sed -e \ 's%^LIB=.*$$%LIB=$(LIB)%;s%^NEWS=.*$$%NEWS=$(NEWS)%;s%^MAPS=.*$$%MAPS=$(MAPS)%'\ ! uucp.from.news.sh > uucp.from.news install: mapsh cp uuhosts /usr/local/uuhosts --- 24,31 ----- uucpnews: uucpnews.sh sed -e \ 's%^LIB=.*$$%LIB=$(LIB)%;s%^NEWS=.*$$%NEWS=$(NEWS)%;s%^MAPS=.*$$%MAPS=$(MAPS)%'\ ! uucpnews.sh > uucpnews ! chmod +x uucpnews install: mapsh cp uuhosts /usr/local/uuhosts diff -c -r ./uuhosts.sh ../uuhosts.sh *** ./uuhosts.sh Sat Jan 5 14:28:53 1985 --- ../uuhosts.sh Tue Dec 18 09:18:13 1984 *************** *** 1,5 #!/bin/sh ! # '@(#) uuhosts.sh 1.39 84/12/15' # PATH will have to be adjusted for non-BSD systems. PATH=/usr/local:/usr/ucb:/bin:/usr/bin --- 1,5 ----- #!/bin/sh ! # '@(#) uuhosts.sh 1.40 84/12/18' # PATH will have to be adjusted for non-BSD systems. PATH=/usr/local:/usr/ucb:/bin:/usr/bin *************** *** 221,227 echo ' USENET news host information:' sed -n -e "/^Name:[ ]*${arg}/,/^$/p" \ ! `$look $lookopt$arg Index | awk '{print $2}'` done exit 0 ;; --- 221,227 ----- echo ' USENET news host information:' sed -n -e "/^Name:[ ]*${arg}/,/^$/p" \ ! `$look $lookopt$arg Index | awk '{print $2}'` /dev/null done exit 0 ;; @//E*O*F patches/ exit 0 -- 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