[net.mail] Hosts.txt Filter Needed

dw@rocksvax.UUCP (Don Wegeng) (08/10/85)

Has anyone written a filter which will translate the Arpanet Hosts.txt
file into a syntax that Pathalias can use? I'd like to add Arpa sites
to my mailrouting code without having to spend huge amounts of time in
the editor (Hosts.txt changes a lot).

Thanks,
/Don
-- 

"Old age and treachery will overcome youth and skill."

arpa:	Wegeng.Henr@Xerox.ARPA
csnet:	Wegeng.Henr@Xerox.ARPA
ns:	dw:Wbst207V:Xerox
uucp:	{allegra,amd,decvax!rochester,princeton}!rocksvax!dw

jww@sdcsvax.UUCP (Joel West) (08/14/85)

> Has anyone written a filter which will translate the Arpanet Hosts.txt
> file into a syntax that Pathalias can use? I'd like to add Arpa sites
> to my mailrouting code without having to spend huge amounts of time in
> the editor (Hosts.txt changes a lot).
> 
> arpa:	Wegeng.Henr@Xerox.ARPA
> csnet:	Wegeng.Henr@Xerox.ARPA
> ns:	dw:Wbst207V:Xerox
> uucp:	{allegra,amd,decvax!rochester,princeton}!rocksvax!dw


Here's what I've got.  It was a quick hack and probably could use some
improvement, so let me know if you don't like it.


	Joel West	CACI, Inc. - Federal (c/o Gould CSD)
	{decvax!sdcsvax,ihnp4!bonnie}!gould9!joel
	gould9!joel@NOSC.ARPA		(also joel@NOSC)


#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	MKARPA.sh
# This archive created: Tue Aug 13 19:52:47 1985
export PATH; PATH=/bin:$PATH
if test -f 'MKARPA.sh'
then
	echo shar: over-writing existing file "'MKARPA.sh'"
fi
cat << \SHAR_EOF > 'MKARPA.sh'
#!/bin/sh
# @(#) MKARPA.sh 6/30/85
# /usr/local/uucp/maps/MKARPA.sh by Joel West <joel@gould9.UUCP>
#
#    Add ARPA /etc/hosts entries to pathalias database
#    Currently lists only canonical (1st) name for compactness
#
# To work at your site, add the following changes:
#	1) Make SERVER to what you believe the most reliable gateway from your
#	   location to the ARPA network.
#	2) Change the grep to refer to the actual input file (name
#	   shown is only a suggestion.)
#	3) Modify your path table Makefile to include file LOC.ARPA
#	   as a data file and pass option "-d ARPANET" to pathalias.
#
# May require some hand-editing of resultant file.  For example, some 
# sendmail configurations and older versions of pathalias may barf on
# a name with dots, e.g. "ucb-arpa.berkeley.edu"
#
# Please report any problems or changes to 
#	ihnp4!bonnie!gould9!joel	joel%gould9@NOSC.ARPA
#
SERVER=noscvax
echo -n 'ARPANET = @{' >LOC.ARPA
grep -v '^#' /etc/hosts.arpa | awk '{printf "%s, \n", $2 }'  \
  |  sort -u | tail +2 \
  | awk 'BEGIN {ORS=""; i=6} {if (i>5){printf "\n\t"; i=0}; print $0 ; i++}'   \
>>LOC.ARPA
echo 'VOID }(DEDICATED)' >>LOC.ARPA

# Requires -d ARPANET in makefile
echo >>LOC.ARPA
echo "$SERVER	ARPANET" >>LOC.ARPA
SHAR_EOF
#	End of shell archive
exit 0