update-serial.pl
branchhs12
changeset 71 e25fc893e203
parent 70 bffb3f2cca90
child 72 d3d2108f07da
--- a/update-serial.pl	Mon Jan 03 16:13:54 2011 +0100
+++ b/update-serial.pl	Mon Jan 03 16:49:56 2011 +0100
@@ -12,9 +12,9 @@
 use IO::File;
 use POSIX qw(strftime);
 use if $ENV{DEBUG} => "Smart::Comments";
+use my::Config qw(get_config);
 
 sub uniq(@);
-sub read_conf(@);
 sub zones(@);
 sub changed_zones();
 sub update_index($);
@@ -51,10 +51,10 @@
     ) or pod2usage;
 
     # merge the config and the defined options from commandline
-    %config = (
-        read_conf("$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf"),
-        map { $_ => $opt{$_} } grep { defined $opt{$_} } keys %opt
-    );
+    %config = get_config("$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf", \%opt);
+
+    ### %config
+    exit;
 
     our $bind_dir = $config{bind_dir};
     our $conf_dir = $config{zone_conf_dir};
@@ -90,26 +90,6 @@
     keys %all;
 }
 
-sub read_conf(@) {
-    my @configs = @_;
-    my %config;
-
-    my ($config) = grep { -f } @configs
-      or die "No config found (looked at @configs)\n";
-
-    open(my $fh => $config) or die "$config: $!\n";
-
-    while (<$fh>) {
-        chomp;
-        s/#.*//;
-        s/\s//g;
-        my ($k, $v) = split(/\s*=\s*/, $_, 2) or next;
-        $config{$k} = $v;
-    }
-
-    return %config;
-}
-
 sub zones(@) {
 
     # check whether the zones in argv are managed zones and