Continue to fine-tune params processing

This commit is contained in:
Tom Eastep 2010-12-01 13:57:16 -08:00
parent d33491d6c6
commit f68bfde86f

View File

@ -2902,12 +2902,15 @@ sub get_params() {
my $variable; my $variable;
if ( $params[0] =~ /^declare/ ) { if ( $params[0] =~ /^declare/ ) {
#
# getparams was interpreted by bash
#
for ( @params ) { for ( @params ) {
if ( /^declare -x (.*?)="(.*[^\\])"$/ ) { if ( /^declare -x (.*?)="(.*[^\\])"$/ ) {
$params{$1} = $2 unless $1 eq '_'; $params{$1} = $2 unless $1 eq '_';
} elsif ( /^declare -x (.*?)="(.*)$/ ) { } elsif ( /^declare -x (.*?)="(.*)$/ ) {
$params{$variable=$1}="${2}\n"; $params{$variable=$1}="${2}\n";
} elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""/ ) { } elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) {
$params{$1} = ''; $params{$1} = '';
} else { } else {
assert($variable); assert($variable);
@ -2916,8 +2919,13 @@ sub get_params() {
} }
} }
} else { } else {
#
# getparams was interpreted by dash/ash/busybox
#
for ( @params ) { for ( @params ) {
if ( /^export (.*?)='(.*)'$/ ) { if ( /^export (.*?)='(.*'"'"')$/ ) {
$params{$variable=$1}="${2}\n";
} elsif ( /^export (.*?)='(.*)'$/ ) {
$params{$1} = $2 unless $1 eq '_'; $params{$1} = $2 unless $1 eq '_';
} elsif ( /^export (.*?)='(.*)$/ ) { } elsif ( /^export (.*?)='(.*)$/ ) {
$params{$variable=$1}="${2}\n"; $params{$variable=$1}="${2}\n";