support true and false in config_get_bool
[openwrt.git] / package / base-files / files / etc / functions.sh
index 4446931..284ed4c 100755 (executable)
@@ -127,8 +127,8 @@ 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";;
+               1|on|true|enabled) export ${NO_EXPORT:+-n} "$1=1";;
+               0|off|false|disabled) export ${NO_EXPORT:+-n} "$1=0";;
                *) eval "$1=${4:-0}";;
        esac
 }
@@ -146,14 +146,16 @@ config_set() {
 
 config_foreach() {
        local function="$1"
-       local type="$2"
+       [ "$#" -ge 1 ] && shift
+       local type="$1"
+       [ "$#" -ge 1 ] && shift
        local section cfgtype
        
        [ -z "$CONFIG_SECTIONS" ] && return 0
        for section in ${CONFIG_SECTIONS}; do
                config_get cfgtype "$section" TYPE
                [ -n "$type" -a "x$cfgtype" != "x$type" ] && continue
-               eval "$function \"\$section\""
+               eval "$function \"\$section\" \"\$@\""
        done
 }
 
This page took 0.028496 seconds and 4 git commands to generate.