zone-rm.pl
branchhs12
changeset 71 e25fc893e203
parent 41 3c10c45c6a59
child 72 d3d2108f07da
--- a/zone-rm.pl	Mon Jan 03 16:13:54 2011 +0100
+++ b/zone-rm.pl	Mon Jan 03 16:49:56 2011 +0100
@@ -4,29 +4,10 @@
 use strict;
 use File::Path;
 use FindBin;
+use my::Config qw(get_config);
 
 # liest die Konfiguration ein
-my @configs = ("$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf");
-my %config;
-
-foreach (grep { -f } @configs) {
-    open(CONFIG, $_) or die "Can't open $_: $!\n";
-}
-
-unless (seek(CONFIG, 0, 0)) {
-    die "Can't open config (searched: @configs)\n";
-}
-
-while (<CONFIG>) {
-    chomp;
-    s/#.*//;
-    s/\t//g;
-    s/\s//g;
-    next unless length;
-    my ($cname, $ccont) = split(/\s*=\s*/, $_, 2);
-    $config{$cname} = $ccont;
-}
-close(CONFIG);
+my %config = get_config("$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf");
 
 my $master_dir = $config{"master_dir"};
 my $conf_dir   = $config{"zone_conf_dir"};