mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-30 17:39:33 +01:00
Improve INCLUDE processing
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5742 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
5eccf1fd71
commit
de26cbb9a1
@ -280,27 +280,28 @@ sub expand_shell_variables( $ ) {
|
|||||||
#
|
#
|
||||||
# Stash away file references here when we encounter INCLUDE
|
# Stash away file references here when we encounter INCLUDE
|
||||||
#
|
#
|
||||||
my @filestack;
|
my @openstack;
|
||||||
my $currentfile;
|
my $currentfile;
|
||||||
|
|
||||||
sub read_a_line {
|
sub read_a_line {
|
||||||
|
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
while ( $line = <$currentfile> ) {
|
while ( $line = <$currentfile> ) {
|
||||||
chomp $line;
|
|
||||||
next if $line =~ /^\s*#/;
|
next if $line =~ /^\s*#/;
|
||||||
next if $line =~ /^\s*$/;
|
next if $line =~ /^\s*$/;
|
||||||
|
chomp $line;
|
||||||
|
|
||||||
$line =~ s/#.*$//;
|
$line =~ s/#.*$//;
|
||||||
|
|
||||||
expand_shell_variables( $line );
|
expand_shell_variables( $line );
|
||||||
|
|
||||||
|
if ( $line =~ /^\s*INCLUDE\s/ ) {
|
||||||
|
|
||||||
my @line = split /\s+/, $line;
|
my @line = split /\s+/, $line;
|
||||||
|
|
||||||
if ( $line[0] eq 'INCLUDE' ) {
|
|
||||||
fatal_error "Missing file name after 'INCLUDE'" unless @line > 1;
|
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;
|
||||||
|
|
||||||
if ( @filestack == 4 ) {
|
if ( @openstack == 4 ) {
|
||||||
warning_message "INCLUDEs nested too deeply; $line ignored";
|
warning_message "INCLUDEs nested too deeply; $line ignored";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
@ -309,7 +310,7 @@ sub read_a_line {
|
|||||||
|
|
||||||
fatal_error "$filename not found" unless ( -f $filename );
|
fatal_error "$filename not found" unless ( -f $filename );
|
||||||
|
|
||||||
push @filestack, $currentfile;
|
push @openstack, $currentfile;
|
||||||
|
|
||||||
$currentfile = undef;
|
$currentfile = undef;
|
||||||
|
|
||||||
@ -321,14 +322,16 @@ sub read_a_line {
|
|||||||
|
|
||||||
close $currentfile;
|
close $currentfile;
|
||||||
|
|
||||||
return 0 unless @filestack;
|
return 0 unless @openstack;
|
||||||
|
|
||||||
$currentfile = pop @filestack;
|
$currentfile = pop @openstack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the shorewall.conf file and establish global hashes %config and %env.
|
# - Read the shorewall.conf file
|
||||||
|
# - Read the capabilities file created by the compiler front-end
|
||||||
|
# - establish global hashes %config , %env and %capabilities
|
||||||
#
|
#
|
||||||
sub get_configuration() {
|
sub get_configuration() {
|
||||||
my $file = find_file 'shorewall.conf';
|
my $file = find_file 'shorewall.conf';
|
||||||
|
Loading…
Reference in New Issue
Block a user