#!BOURNESHELL
#	program:	i2faddr
#	input:		one in-addr.arpa domain name on the command line.
#	output:		the forward address of this reverse address is sent
#			to stdout, or "ERROR" to stdout if problem occurs.
#			Usage printed to stderr, too, if usage error occurs.
#	example:	"24.64.114.134.in-addr.arpa." -> "134.114.64.24"
#	exit value:	0 if nothing goes wrong, 1 if something did.

AWK=DOMLIB/i2faddr.awk

if test $# -ne 1; then
	echo "usage: $0 ipaddress" >&2
	echo 'ERROR'
	exit 1
fi

echo $1 | awk -f $AWK
status=$?
if test $status -ne 0; then
	echo 'ERROR'
	exit 1
fi

exit $status
