:
#
#	@(#) mnlist 1.5 89/05/24 
#
#	Copyright (C) The Santa Cruz Operation, 1989.
#	This Module contains Proprietary Information of
#	The Santa Cruz Operation, and should be treated as Confidential.
#
# mnlist -- Make simple micnet channel and domain
#     tables from the micnet topology file /usr/lib/mail/top
#
# IFS="{space}{tab}{newline}"
# 
IFS=" 	
"
PATH=/bin:/usr/bin

#
# Configuration defaults
#
LDOMAIN=UUCP
TOP=/usr/lib/mail/top
TMPFILE=/tmp/mnchn$$

trap "rm -f $TMPFILE; exit 0" 1 2 3 15

#
#  get the system names
#

awk '/^[^#]/ {if (NF == 5) {print $1; print $3}}' <$TOP | sort -u > $TMPFILE

#
#  generate the domain file
#

if [ -f micnet.dom ]
then
    mv micnet.dom micnet.dom-
fi

sed -e "s/\(.*\)/\1		\1.$LDOMAIN/" \
	$TMPFILE > micnet.dom

#
#  generate the channel file
#

if [ -f micnet.chn ]
then
    mv micnet.chn micnet.chn-
fi

sed -e "s/\(.*\)/\1.$LDOMAIN	\1:%s/" \
	$TMPFILE > micnet.chn


rm -f $TMPFILE

exit 0
