Add option -v (verbose)

This commit is contained in:
hjp 2016-07-05 18:09:24 +00:00
parent 7aa8246502
commit 8187b62fc6
1 changed files with 11 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/perl -w #!/usr/bin/perl
use warnings;
use strict; use strict;
use Net::DNS; use Net::DNS;
@ -7,6 +8,13 @@ sub usage {
exit(1); exit(1);
} }
my $verbose;
if (($ARGV[0] || '') eq '-v') {
$verbose = 1;
shift @ARGV;
}
usage() unless (@ARGV == 1); usage() unless (@ARGV == 1);
# generic resolver # generic resolver
@ -57,6 +65,7 @@ sub check_ptr {
return; return;
} }
for my $name (@names) { for my $name (@names) {
print "I: [$addr] -> $name\n" if $verbose;
check_a($name, $addr); check_a($name, $addr);
} }
} }
@ -92,6 +101,7 @@ sub check_a {
return; return;
} }
for my $addr (@addrs) { for my $addr (@addrs) {
print "I: $name -> [$addr]\n" if $verbose;
check_ptr($addr, $name); check_ptr($addr, $name);
} }
} }