+
+chdir "$base/primary" or die "$0: chdir $base/primary: $!";
+beginfile('primary.zones');
+
+for $f (<*_db>) {
+ $zone= $f; $zone =~ s/_db$//;
+
+
+for f in $zones
+do
+ zone="`echo $f | sed -e 's/_db$//'`"
+ cat <<END
+zone "$zone" {
+ type master;
+ file "primary/$f";
+};
+END
+done
+endfile
+
+
+
+sub beginfile ($) {
+ $currentfile= $_[0];
+ $currentfile_opened= $install ? "$conf/$currentfile.new" : "/dev/null";
+ open CFF, "> $toopen" or die "$0: begin $currentfile_opened: $!\n";
+}
+
+endfile () {
+ close CFF or die "$0: close $currentfile_opened: $!\n";
+ push @files, $currentfile;
+}
+
+sub installfiles () {
+ return unless $install;
+ chdir $conf or die "$0: chdir $conf: $!\n";
+ for $f (@files) {
+ rename "$f.new", $f or die "$0: install new $f: $!\n";
+ }
+}
+
+warning () {
+ echo >&2 "$zone $style: $*"
+ warnings=$[$warnings+1]
+}
+
+equlines () {
+ if [ "x`echo \" $2\" | wc -l`" != "x`echo \" $3\" | wc -l`" ]
+ then
+ warning "$1 >$2|$3<"
+ fi
+}
+
+checkhostout () {
+ set +e
+ hostout="`host $1 \"$zone\" 2>&1 >/dev/null $2 | egrep -v \
+'^ \!\!\! .* SOA primary .* is not advertised via NS$'`"
+ set -e
+ if [ "x$hostout" = x ]; then return; fi
+ if $hostfirstwarn
+ then
+ warning "warnings from host:"
+ hostfirstwarn=0
+ fi
+ echo >&2 "$hostout"
+}
+
+progress () {
+ if $progress
+ then
+ echo -n "$zone $style " >&2
+ echo -ne '\r' >&2
+ fi
+}
+
+myname=''
+