From 9dd6f86c558e78cdb013ce3f9fb57ef7784fb494 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 6 Apr 2012 15:46:01 -0700 Subject: [PATCH] Use read_a_line() in the embedded_shell() and embedded_perl() functions. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 700ac343c..0b5abdf7a 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -1952,10 +1952,9 @@ sub embedded_shell( $ ) { my $last = 0; - while ( <$currentfile> ) { - $currentlinenumber++; - last if $last = s/^\s*\??END(\s+SHELL)?\s*;?//; - $command .= $_; + while ( read_a_line( 0, 0, 1 ) ) { + last if $last = $currentline =~ s/^\s*\??END(\s+SHELL)?\s*;?//; + $command .= $currentline; } fatal_error ( "Missing END SHELL" ) unless $last; @@ -1973,6 +1972,8 @@ sub embedded_shell( $ ) { $ifstack = @ifstack; } +sub read_a_line(;$$$); + sub embedded_perl( $ ) { my $multiline = shift; @@ -1987,10 +1988,9 @@ sub embedded_perl( $ ) { my $last = 0; - while ( <$currentfile> ) { - $currentlinenumber++; - last if $last = s/^\s*\??END(\s+PERL)?\s*;?//; - $command .= $_; + while ( read_a_line( 0, 0, 1 ) ) { + last if $last = $currentline =~ s/^\s*\??END(\s+PERL)?\s*;?//; + $command .= $currentline; } fatal_error ( "Missing END PERL" ) unless $last;