[PATCH 1/1] xt_asn: support quiet mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Philip Prindeville <philipp@xxxxxxxxxxxxxxxxxxxxx>

Signed-off-by: Philip Prindeville <philipp@xxxxxxxxxxxxxxxxxxxxx>
---
 asn/xt_asn_build | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/asn/xt_asn_build b/asn/xt_asn_build
index 4c406799480538c03efb8a5ccb9479aef3ef3060..63019ca689c56d5c9c686838fc4cc758047887e5 100755
--- a/asn/xt_asn_build
+++ b/asn/xt_asn_build
@@ -18,6 +18,7 @@ my $csv = Text::CSV_XS->new({
 	binary => 1,
 	eol => $/,
 }); # or Text::CSV
+my $quiet = 0;
 my $source_dir = ".";
 my $target_dir = ".";
 my $output_txt;
@@ -27,6 +28,7 @@ my $output_txt;
 	"D=s" => \$target_dir,
 	"S=s" => \$source_dir,
 	"O=s" => \$output_txt,
+	"q" => \$quiet,
 );
 
 if (!-d $source_dir) {
@@ -85,7 +87,7 @@ sub collect
 
 		$asns{$asn}->{pool_v4}->add($cidr);
 
-		if ($. % 4096 == 0) {
+		if (!$quiet && $. % 4096 == 0) {
 			print STDERR "\r\e[2K$. entries";
 		}
 
@@ -95,7 +97,7 @@ sub collect
 		}
 	}
 
-	print STDERR "\r\e[2K$. entries total\n";
+	print STDERR "\r\e[2K$. entries total\n" unless ($quiet);
 
 	close($fh);
 
@@ -132,7 +134,7 @@ sub collect
 
 		$asns{$asn}->{pool_v6}->add($cidr);
 
-		if ($. % 4096 == 0) {
+		if (!$quiet && $. % 4096 == 0) {
 			print STDERR "\r\e[2K$. entries";
 		}
 
@@ -142,7 +144,7 @@ sub collect
 		}
 	}
 
-	print STDERR "\r\e[2K$. entries total\n";
+	print STDERR "\r\e[2K$. entries total\n" unless ($quiet);
 
 	close($fh);
 
-- 
2.34.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux