#!/usr/bin/perl -w use strict; use Symbol; sub usage{ my ($conf_fn) = @_; print STDOUT <) { chomp $line; $line =~ s/[ \t]*#.*//; $line =~ s/[ \t]*127.0.0.1[ \t]*//; $line =~ s/[*]//; $line =~ s/^[.]//; if ($line ne '' && $line ne 'localhost') { $hosts[$ii++] = lc($line) ; } } close $dat_i; if ($allmode) { ### } else { @hosts = prune(@hosts); } ## Sort them into nice-to-the-eye order: @hosts = sort {rank($a) cmp rank($b)} @hosts; if ($listmode) { my $nd = @hosts; print STDERR "Writing out $nd domains\n"; foreach my $host (@hosts) { print "$host\n"; } exit(0); } ############################################################ ## Write the configuration file: my $conf_o = Symbol::gensym; open ($conf_o, ">$conf_fn") || die "Cannot open file '$conf_fn'\n"; foreach my $host (@hosts) { print $conf_o <$zone_fn") || die "Cannot open file '$zone_fn'\n"; print $zone_o <<\EoF; ; ; BIND forward lookup for execrated networks ; $TTL 604800 @ IN SOA localhost. root.localhost. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS localhost. EoF close $zone_o; ############################################################ } ## end of main program