Tighen up parsing of bracketed lists

This commit is contained in:
Tom Eastep 2010-09-20 07:05:23 -07:00
parent 0ed33a0552
commit f64993fe40

View File

@ -2896,12 +2896,16 @@ sub mysplit( $ ) {
my $element = shift @input; my $element = shift @input;
if ( $element =~ /\[/ ) { if ( $element =~ /\[/ ) {
while ( $element =~ tr/[/[/ != $element =~ tr/]/]/ ) { while ( $element =~ tr/[/[/ > $element =~ tr/]/]/ ) {
last unless @input; last unless @input;
$element .= ( ',' . shift @input ); $element .= ( ',' . shift @input );
} }
fatal_error "Invalid Host List ($_[0])" unless $element =~ tr/[/[/ == $element =~ tr/]/]/; if ( $element =~ tr/[/[/ > $element =~ tr/]/]/ ) {
fatal_error "Missing ']' ($element)";
} else {
fatal_error "Mismatched [...] ($element)" unless $element =~ tr/[/[/ == $element =~ tr/]/]/;
}
} }
push @result, $element; push @result, $element;