Only do SET and RESET when we aren't omitting.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-12-04 16:27:18 -08:00
parent c18996b6f5
commit 2fbbc70e83

View File

@ -2044,21 +2044,25 @@ sub process_conditional( $$$$ ) {
cond_error( q(Unexpected "?ENDIF" without matching ?IF or ?ELSE) , $filename, $linenumber ) if @ifstack <= $ifstack; cond_error( q(Unexpected "?ENDIF" without matching ?IF or ?ELSE) , $filename, $linenumber ) if @ifstack <= $ifstack;
$omitting = $prioromit; $omitting = $prioromit;
pop @ifstack; pop @ifstack;
} elsif ( $keyword =~ /^SET/ ) { } elsif ( ! $omitting ) {
fatal_error( "Missing SET variable", $filename, $linenumber ) unless supplied $expression; if ( $keyword =~ /^SET/ ) {
( my $var , $expression ) = split ' ', $expression, 2; fatal_error( "Missing SET variable", $filename, $linenumber ) unless supplied $expression;
cond_error( "Invalid SET variable ($var)", $filename, $linenumber) unless $var =~ /^\$?([a-zA-Z]\w*)$/; ( my $var , $expression ) = split ' ', $expression, 2;
cond_error( "Missing SET expression" , $filename, $linenumber) unless supplied $expression; cond_error( "Invalid SET variable ($var)", $filename, $linenumber) unless $var =~ /^\$?([a-zA-Z]\w*)$/;
$variables{$1} = evaluate_expression( $expression, $filename, $linenumber ); cond_error( "Missing SET expression" , $filename, $linenumber) unless supplied $expression;
} else { $variables{$1} = evaluate_expression( $expression,
my $var = $expression; $filename,
cond_error( "Missing RESET variable", $filename, $linenumber) unless supplied $var; $linenumber );
cond_error( "Invalid RESET variable ($var)", $filename, $linenumber) unless $var =~ /^\$?([a-zA-Z]\w*)$/;
if ( exists $variables{$1} ) {
delete $variables{$1};
} else { } else {
cond_warning( "Variable $1 does not exist", $filename, $linenumber ); my $var = $expression;
cond_error( "Missing RESET variable", $filename, $linenumber) unless supplied $var;
cond_error( "Invalid RESET variable ($var)", $filename, $linenumber) unless $var =~ /^\$?([a-zA-Z]\w*)$/;
if ( exists $variables{$1} ) {
delete $variables{$1};
} else {
cond_warning( "Variable $1 does not exist", $filename, $linenumber );
}
} }
} }