-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
- wifi-device)
- append DEVICES "$CONFIG_SECTION"
- ;;
- wifi-iface)
- config_get device "$CONFIG_SECTION" device
- config_get vifs "$device" vifs
- append vifs "$CONFIG_SECTION"
- config_set "$device" vifs "$vifs"
- ;;
- esac
+scan_wifi() {
+ local cfgfile="$1"
+ config_cb() {
+ config_get TYPE "$CONFIG_SECTION" TYPE
+ case "$TYPE" in
+ wifi-device)
+ append DEVICES "$CONFIG_SECTION"
+ ;;
+ wifi-iface)
+ config_get device "$CONFIG_SECTION" device
+ config_get vifs "$device" vifs
+ append vifs "$CONFIG_SECTION"
+ config_set "$device" vifs "$vifs"
+ ;;
+ esac
+ }
+ config_load "${cfgfile:-wireless}"