Fix script per squid
This commit is contained in:
38
proxy/squid_acl/shellwords.pl
Normal file
38
proxy/squid_acl/shellwords.pl
Normal file
@@ -0,0 +1,38 @@
|
||||
sub shellwords {
|
||||
package shellwords;
|
||||
local($_) = join('', @_) if @_;
|
||||
local(@words,$snippet,$field);
|
||||
|
||||
s/^\s+//;
|
||||
while ($_ ne '') {
|
||||
$field = '';
|
||||
for (;;) {
|
||||
if (s/^"(([^"\\]|\\[\\"])*)"//) {
|
||||
($snippet = $1) =~ s#\\(.)#$1#g;
|
||||
}
|
||||
elsif (/^"/) {
|
||||
die "Unmatched double quote: $_\n";
|
||||
}
|
||||
elsif (s/^'(([^'\\]|\\[\\'])*)'//) {
|
||||
($snippet = $1) =~ s#\\(.)#$1#g;
|
||||
}
|
||||
elsif (/^'/) {
|
||||
die "Unmatched single quote: $_\n";
|
||||
}
|
||||
elsif (s/^\\(.)//) {
|
||||
$snippet = $1;
|
||||
}
|
||||
elsif (s/^([^\s\\'"]+)//) {
|
||||
$snippet = $1;
|
||||
}
|
||||
else {
|
||||
s/^\s+//;
|
||||
last;
|
||||
}
|
||||
$field .= $snippet;
|
||||
}
|
||||
push(@words, $field);
|
||||
}
|
||||
@words;
|
||||
}
|
||||
1;
|
||||
Reference in New Issue
Block a user