From d19dac49d0611efc640e15f8accf6f8f821ab4f2 Mon Sep 17 00:00:00 2001 From: teastep Date: Sun, 8 Apr 2007 14:35:31 +0000 Subject: [PATCH] A little Easter Morning hacking git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5859 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Config.pm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Shorewall-perl/Shorewall/Config.pm b/Shorewall-perl/Shorewall/Config.pm index 6286b6848..2fb0dd43f 100644 --- a/Shorewall-perl/Shorewall/Config.pm +++ b/Shorewall-perl/Shorewall/Config.pm @@ -281,8 +281,6 @@ my %no_pad = ( COMMENT => 1, # # Pre-process a line from a configuration file. -# chomp it. -# compress out redundent white space. # ensure that it has an appropriate number of columns. # supply '-' in omitted trailing columns. # @@ -340,6 +338,10 @@ sub close_file() { } } +# +# The following two functions allow module clients to nest opens. This happens frequently +# in the Actions module. +# sub push_open( $ ) { push @includestack, [ $currentfile, $currentfilename, $currentlinenumber ]; @@ -364,7 +366,7 @@ sub pop_open() { } # -# Read a line from the current open stack. +# Read a line from the current include stack. # # - Ignore blank or comment-only lines. # - Remove trailing comments. @@ -386,13 +388,11 @@ sub read_a_line { # # Continuation # - if ( substr( $nextline, -1, 1 ) eq '\\' ) { - $line .= substr( $nextline, 0, -1 ); + if ( substr( ( $line .= $nextline ), -1, 1 ) eq '\\' ) { + $line = substr( $line, 0, -1 ); next; } - $line .= $nextline; - $line =~ s/#.*$//; # Remove Trailing Comments -- result might be a blank line # # Ignore ( concatenated ) Blank Lines @@ -415,8 +415,7 @@ sub read_a_line { my @line = split /\s+/, $line; - fatal_error "Missing file name after 'INCLUDE'" unless @line > 1; - fatal_error "Invalid INCLUDE command: $line" if @line > 2; + fatal_error "Invalid INCLUDE command: $line" if @line != 2; fatal_error "INCLUDEs nested too deeply: $line" if @includestack >= 4; my $filename = find_file $line[1];