From a649be0f538a7795c7676895c9ad77127536d589 Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 21 Jun 2007 17:44:41 +0000 Subject: [PATCH] Make buildports.pl a little more bulletproof git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6637 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/buildports.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Shorewall-perl/buildports.pl b/Shorewall-perl/buildports.pl index 262561050..09cf555b0 100755 --- a/Shorewall-perl/buildports.pl +++ b/Shorewall-perl/buildports.pl @@ -41,10 +41,12 @@ sub print_it( $$ ) { my $length = length $name; if ( $name =~ /\W/ || $name =~ /^\d/ ) { - $tabs = "\t" x int ( ( 27 - $length ) / 8 ); + my $repeat = int ( ( 27 - $length ) / 8 ); + $tabs = $repeat > 0 ? "\t" x $repeat : ' '; print "${offset}'${name}'${tabs}=> $number,\n"; } else { - $tabs = "\t" x int ( ( 29 - $length ) / 8 ); + my $repeat = int ( ( 29 - $length ) / 8 ); + $tabs = $repeat > 0 ? "\t" x $repeat : ' '; print "${offset}${name}${tabs}=> $number,\n"; } }