mirror of
https://codeberg.org/h3xx/you-dont-need-pihole.git
synced 2024-08-14 20:27:01 +00:00
Require Perl 5.12
Fix some postfix 'if' statements too.
This commit is contained in:
parent
133b271208
commit
7d9188c6fa
1 changed files with 16 additions and 6 deletions
|
@ -13,7 +13,7 @@
|
||||||
# You may NOT use this software for commercial purposes.
|
# You may NOT use this software for commercial purposes.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
use strict;
|
use 5.012;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Getopt::Long qw/ GetOptions :config no_ignore_case /;
|
use Getopt::Long qw/ GetOptions :config no_ignore_case /;
|
||||||
|
@ -27,7 +27,9 @@ sub add_domain_list {
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
foreach my $line (read_stripped($file)) {
|
foreach my $line (read_stripped($file)) {
|
||||||
my $domain = lc $line;
|
my $domain = lc $line;
|
||||||
++$dupes if defined $domains{$domain};
|
if (defined $domains{$domain}) {
|
||||||
|
++$dupes;
|
||||||
|
}
|
||||||
$domains{$domain} = 1;
|
$domains{$domain} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +49,9 @@ sub add_host_file {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
my $domain = lc $parts[1];
|
my $domain = lc $parts[1];
|
||||||
++$dupes if defined $domains{$domain};
|
if (defined $domains{$domain}) {
|
||||||
|
++$dupes;
|
||||||
|
}
|
||||||
$domains{$domain} = 1;
|
$domains{$domain} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +121,13 @@ MAIN: {
|
||||||
printf STDERR "%d domains written to %s from\n", $written, $out // 'STDOUT';
|
printf STDERR "%d domains written to %s from\n", $written, $out // 'STDOUT';
|
||||||
printf STDERR " - %d .domains files\n", (scalar @domain_lists);
|
printf STDERR " - %d .domains files\n", (scalar @domain_lists);
|
||||||
printf STDERR " - %d .hosts files\n", (scalar @hosts_lists);
|
printf STDERR " - %d .hosts files\n", (scalar @hosts_lists);
|
||||||
printf STDERR "(%d duplicates)\n", $dupes if $dupes;
|
if ($dupes) {
|
||||||
printf STDERR "(%d domains removed via allowlist)\n", $removed_allowed if $removed_allowed;
|
say STDERR "($dupes duplicates)";
|
||||||
printf STDERR "(%d skipped)\n", $skip if $skip;
|
}
|
||||||
|
if ($removed_allowed) {
|
||||||
|
say STDERR "($removed_allowed domains removed via allowlist)";
|
||||||
|
}
|
||||||
|
if ($skip) {
|
||||||
|
say STDERR "($skip skipped)";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue