move config_get_bool from /sbin/wifi to /etc/functions.sh
authorFelix Fietkau <nbd@openwrt.org>
Tue, 27 Feb 2007 23:09:57 +0000 (23:09 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 27 Feb 2007 23:09:57 +0000 (23:09 +0000)
SVN-Revision: 6407

package/base-files/files/etc/functions.sh
package/base-files/files/sbin/wifi

index 84121c5458efdd5a94a48bc034dde26807fcab76..931f4be472d01a799b690a917570d323f3488471 100755 (executable)
@@ -105,6 +105,17 @@ config_get() {
        esac
 }
 
+# config_get_bool <variable> <section> <option> [<default>]
+config_get_bool() {
+       local _tmp
+       config_get "_tmp" "$2" "$3"
+       case "$_tmp" in
+               1|on|enabled) export ${NO_EXPORT:+-n} "$1=1";;
+               0|off|disabled) export ${NO_EXPORT:+-n} "$1=0";;
+               *) eval "$1=${4:-0}";;
+       esac
+}
+
 config_set() {
        local section="$1"
        local option="$2"
index 272aa16fa303c64bbcd1ab5a51a9ff752aacdc75..2b4f1ce1c2c90b403ab19a963e78619756491dc6 100755 (executable)
@@ -78,17 +78,6 @@ start_net() {(
        setup_interface "$1" "$2"
 )}
 
-config_get_bool() {
-       local _tmp
-       config_get "$1" "$2" "$3"
-       eval "_tmp=\$$1"
-       case "$_tmp" in
-               1|on|enabled) eval "$1=1";;
-               0|off|disabled) eval "$1=0";;
-               *) eval "$1=${4:-0}";;
-       esac
-}
-
 config_cb() {
        config_get TYPE "$CONFIG_SECTION" TYPE
        case "$TYPE" in