From b7bb78c03de6715d03939ddfb0e4fdcc276b7d57 Mon Sep 17 00:00:00 2001 From: teastep Date: Sat, 10 Mar 2007 04:50:57 +0000 Subject: [PATCH] Report missing Shell Variables git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5481 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/compiler.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/New/compiler.pl b/New/compiler.pl index bfabd9ef7..997c593be 100755 --- a/New/compiler.pl +++ b/New/compiler.pl @@ -3435,9 +3435,17 @@ sub finish_section ( $ ) { sub process_rule1 ( $$$$$$$$$ ); +# +# Macros and actions can have shell variables embedded. This function expands them. +# sub expand_shell_variables( $ ) { my $line = $_[0]; - $line = $1 . $ENV{$2} . $3 while $line =~ /^(.*?)\$([a-zA-Z]\w*\b)(.*)$/; + + while ( $line =~ /^(.*?)\$([a-zA-Z]\w*)(.*)$/ ) { + fatal_error "Shell variable \$$2 not found" unless $ENV{$2}; + $line = $1 . $ENV{$2} . $3 ; + } + $line; }