Allow both {...} and ';' with INLINE

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-04-11 12:57:59 -07:00
parent b33bdeaa02
commit c34cf333ba

View File

@ -1904,6 +1904,8 @@ sub split_line1( $$;$$ ) {
my @maxcolumns = ( keys %$columnsref ); my @maxcolumns = ( keys %$columnsref );
$maxcolumns = @maxcolumns; $maxcolumns = @maxcolumns;
} }
$inline_matches = '';
# #
# First see if there is a semicolon on the line; what follows will be column/value paris # First see if there is a semicolon on the line; what follows will be column/value paris
# #
@ -1914,6 +1916,20 @@ sub split_line1( $$;$$ ) {
# Found it -- be sure there wasn't more than one. # Found it -- be sure there wasn't more than one.
# #
fatal_error "Only one semicolon (';') allowed on a line" if defined $rest; fatal_error "Only one semicolon (';') allowed on a line" if defined $rest;
if ( $currentline =~ /^\s*INLINE(?:\(.*\))?\s/) {
$inline_matches = $pairs;
if ( $columns =~ /^(\s*|.*[^&@%]){(.*)}\s*$/ ) {
#
# Pairs are enclosed in curly brackets.
#
$columns = $1;
$pairs = $2;
} else {
$pairs = '';
}
}
} elsif ( $currentline =~ /^(\s*|.*[^&@%]){(.*)}$/ ) { } elsif ( $currentline =~ /^(\s*|.*[^&@%]){(.*)}$/ ) {
# #
# Pairs are enclosed in curly brackets. # Pairs are enclosed in curly brackets.
@ -1949,28 +1965,22 @@ sub split_line1( $$;$$ ) {
push @line, '-' while @line < $maxcolumns; push @line, '-' while @line < $maxcolumns;
$inline_matches = '';
if ( supplied $pairs ) { if ( supplied $pairs ) {
$pairs =~ s/^\s*//; $pairs =~ s/^\s*//;
$pairs =~ s/\s*$//; $pairs =~ s/\s*$//;
if ( $first =~ /^INLINE(?:\(.*\))?$/) { my @pairs = split( /,?\s+/, $pairs );
$inline_matches = $pairs;
} else {
my @pairs = split( /,?\s+/, $pairs );
for ( @pairs ) { for ( @pairs ) {
fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/; fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/;
my ( $column, $value ) = ( lc $1, $2 ); my ( $column, $value ) = ( lc $1, $2 );
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column}; fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
$column = $columnsref->{$column}; $column = $columnsref->{$column};
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/; fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
$value = $1 if $value =~ /^"([^"]+)"$/; $value = $1 if $value =~ /^"([^"]+)"$/;
fatal_error "Column values may not contain embedded double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/; fatal_error "Column values may not contain embedded double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/;
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/; fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
$line[$column] = $value; $line[$column] = $value;
}
} }
} }