summaryrefslogtreecommitdiff
path: root/package/base-files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-11-22 13:32:24 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-11-22 13:32:24 +0000
commit398f36201b50d1881ba91f7d26b7037b6aebb185 (patch)
tree0194152a3528c142c0bf528776980d26c3dcbe52 /package/base-files
parentf070a7057828cf8aa77293d19f9af9ee40602383 (diff)
downloadmtk-20170518-398f36201b50d1881ba91f7d26b7037b6aebb185.zip
mtk-20170518-398f36201b50d1881ba91f7d26b7037b6aebb185.tar.gz
mtk-20170518-398f36201b50d1881ba91f7d26b7037b6aebb185.tar.bz2
fix various variable copying bugs
SVN-Revision: 5613
Diffstat (limited to 'package/base-files')
-rwxr-xr-xpackage/base-files/default/etc/functions.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/package/base-files/default/etc/functions.sh b/package/base-files/default/etc/functions.sh
index 7d34f57..0e7216d 100755
--- a/package/base-files/default/etc/functions.sh
+++ b/package/base-files/default/etc/functions.sh
@@ -19,7 +19,7 @@ append() {
local value="$2"
local sep="${3:- }"
- eval "$var=\"\${$var:+\${$var}${value:+$sep}}$value\""
+ eval "$var=\"\${$var:+\${$var}\${value:+\$sep}}\$value\""
}
reset_cb() {
@@ -36,13 +36,14 @@ config () {
name="${name:-cfg${_C}}"
config_cb "$cfgtype" "$name"
CONFIG_SECTION="$name"
- eval CONFIG_${CONFIG_SECTION}_TYPE="$cfgtype"
+ eval CONFIG_${CONFIG_SECTION}_TYPE="\$cfgtype"
}
option () {
local varname="$1"; shift
+ local value="$*"
- eval CONFIG_${CONFIG_SECTION}_${varname}="$*"
+ eval CONFIG_${CONFIG_SECTION}_${varname}="\$value"
option_cb "$varname" "$*"
}
@@ -97,7 +98,10 @@ config_get() {
}
config_set() {
- eval CONFIG_${1}_${2}="$3"
+ local section="$1"
+ local option="$2"
+ local value="$3"
+ eval CONFIG_${section}_${option}="\$value"
}
load_modules() {
@@ -133,12 +137,12 @@ strtok() { # <string> { <variable> [<separator>] ... }
val="${val#$tmp$2}"
- eval $1="$tmp"; count=$((count+1))
+ eval $1="\$tmp"; count=$((count+1))
shift 2
done
if [ $# -gt 0 -a "$val" ]; then
- eval $1="$val"; count=$((count+1))
+ eval $1="\$val"; count=$((count+1))
fi
return $count