From 8187b62fc6c2fcbd5c52e26f1545ba6f773a2124 Mon Sep 17 00:00:00 2001 From: hjp Date: Tue, 5 Jul 2016 18:09:24 +0000 Subject: [PATCH] Add option -v (verbose) --- dns/check.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dns/check.pl b/dns/check.pl index 53563a1..e51e391 100644 --- a/dns/check.pl +++ b/dns/check.pl @@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl +use warnings; use strict; use Net::DNS; @@ -7,6 +8,13 @@ sub usage { exit(1); } +my $verbose; + +if (($ARGV[0] || '') eq '-v') { + $verbose = 1; + shift @ARGV; +} + usage() unless (@ARGV == 1); # generic resolver @@ -57,6 +65,7 @@ sub check_ptr { return; } for my $name (@names) { + print "I: [$addr] -> $name\n" if $verbose; check_a($name, $addr); } } @@ -92,6 +101,7 @@ sub check_a { return; } for my $addr (@addrs) { + print "I: $name -> [$addr]\n" if $verbose; check_ptr($addr, $name); } }