#!BOURNESHELL
#	program:	subdom
#	purpose:	Print a list of sub-domains in this domain.  This
#			is not recursive unless the "-r" command-line flag
#			is given.  This is the top-most shell script for
#			the program.  We basically call the recursive main
#			part (subdom2) and return whatever error status he does.
#	input:		Domain name on command line.
#	output:		A list of subdomains within the given domain,
#			or the word "ERROR" (distinguishable from a real
#			record because it has no period on the end).
#	exit value:	0 if succeeds, 1 if fails (and "ERROR" output).
#
TMP=/tmp/subdom0.$$

DOMBIN/subdom2 $* > $TMP
status=$?
if test $status -ne 0; then
	rm -f $TMP
	exit $status
fi

uniq < $TMP
status=$?
if test $status -ne 0; then
	rm -f $TMP
	exit $status
fi

rm -f $TMP
exit 0
