#!/bin/sh
#
# dns-utils - utilities to make DNS easier to configure
# Copyright (C) 1992, 1993, 1995, 1999, 2007 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
# make sure only list one of each alias.
#
tmp=/tmp/$$
PAGER=cat
export PAGER
umask 022
here=`pwd`
if test $? -ne 0 ; then exit 1; fi
if test "$1" != "" ; then bin="$here/$1/bin"; else bin="$here/bin"; fi
fail()
{
echo FAILED test of dns-hosts command 1>&2
cd $here
rm -rf $tmp
exit 1
}
pass()
{
cd $here
rm -rf $tmp
exit 0
}
trap "fail" 1 2 3 15
mkdir $tmp
cd $tmp
cat > test.in << 'foobar'
$origin localhost.
@ in soa bmr.gov.au. hostmaster@bmr.gov.au. (
1.1 ; serial
21600 ; refresh 6 hours
900 ; retry 15 minutes
3600000 ; expire 1000 hours
21600 ) ; minimum 6 hours
in ns bmr.gov.au.
in a 127.0.0.1
loghost. in cname localhost.
loopback. in cname localhost.
foobar
if test $? -ne 0 ; then fail; fi
cat > test.ok << 'foobar'
# Do not edit this file. It is generated
# using a 'dns-hosts test.in test.out' command.
127.0.0.1 localhost loghost loopback
foobar
if test $? -ne 0 ; then fail; fi
$bin/dns-hosts test.in test.out
if test $? -ne 0 ; then fail; fi
diff test.ok test.out
if test $? -ne 0 ; then fail; fi
# probably OK
pass
syntax highlighted by Code2HTML, v. 0.9.1