#!/bin/sh
#
# dns-utils - utilities to make DNS easier to configure
# Copyright (C) 1992, 1993, 1995, 1996, 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/>.
#
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 of the dns-rev 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'
;
; some comments
;
$origin bmr.gov.au.
@ 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
bmr.gov.au. in mx 10 ipcone.bmr.gov.au.
*.bmr.gov.au. in mx 10 ipcone.bmr.gov.au.
;
; Image Processing Centre, ISB
ipcone in a 192.104.43.1
in hinfo "Sun-4/280" "UNIX SunOS 4.1"
garnet in cname ipcone
;
; Image Processing Centre, ISB
ipctwo in a 192.104.43.2
in hinfo "Sun-4/280" "UNIX SunOS 4.1"
topaz in cname ipctwo
foobar
if test $? -ne 0 ; then fail; fi
cat > test.ok << 'foobar'
; Do not edit this file. It is generated
; by a 'dns-rev test.in test.out' command.
$origin 43.104.192.in-addr.arpa.
@ in soa bmr.gov.au. hostmaster.bmr.gov.au. (
1.1 ; serial
21600 ; refresh: 6 hours
900 ; retry: 15 minutes
3600000 ; expire: 5 weeks, 6 days, 16 hours
21600 ) ; minimum: 6 hours
1 in ptr ipcone.bmr.gov.au.
2 in ptr ipctwo.bmr.gov.au.
foobar
if test $? -ne 0 ; then fail; fi
$bin/dns-rev 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