mirror of
https://github.com/webmin/webmin.git
synced 2026-08-07 00:10:40 +01:00
Use standard split_quoted_string function
This commit is contained in:
@@ -68,7 +68,7 @@ while(<$fh>) {
|
||||
s/#.*$//;
|
||||
if (/^\s*(.*)\{\s*$/) {
|
||||
# Start of a section
|
||||
push(@name, &split_words($1));
|
||||
push(@name, &split_quoted_string($1));
|
||||
$section = { 'name' => [ @name ],
|
||||
'members' => [ ],
|
||||
'index' => scalar(@$addto),
|
||||
@@ -83,7 +83,7 @@ while(<$fh>) {
|
||||
elsif ((/^\s*\// || /^\s*"\//) && !$section) {
|
||||
# A path before a section
|
||||
$namestart = $lnum if (!@name);
|
||||
push(@name, &split_words($_));
|
||||
push(@name, &split_quoted_string($_));
|
||||
}
|
||||
elsif (/^\s*}\s*$/) {
|
||||
# End of a section
|
||||
@@ -160,19 +160,6 @@ if (!$argfile) {
|
||||
return wantarray ? (\@rv, $lnum, \@files) : \@rv;
|
||||
}
|
||||
|
||||
# split_words(string)
|
||||
# Split a string like 'foo "bar" baz' into words
|
||||
sub split_words
|
||||
{
|
||||
my ($str) = @_;
|
||||
my @rv;
|
||||
while($str =~ /^\s*"(.*)"(.*)$/ || $str =~ /^\s*(\S+)(.*)$/) {
|
||||
push(@rv, $1);
|
||||
$str = $2;
|
||||
}
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# join_words(word, ...)
|
||||
# Joins an array of words into a string, with quotes if needed
|
||||
sub join_words
|
||||
|
||||
Reference in New Issue
Block a user