From 55a840edd32ac45b35c4d7c604bcfe00e0ee7fbc Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Sun, 13 Sep 2009 23:43:35 -0400 Subject: tabs->spaces, vim modelines Signed-off-by: Jim Pryor --- src-wireless/net-auto | 4 +- src-wireless/netcfg-auto-wireless | 99 ++++++++++++++++++++------------------- 2 files changed, 52 insertions(+), 51 deletions(-) (limited to 'src-wireless') diff --git a/src-wireless/net-auto b/src-wireless/net-auto index d297f5f..6c15f52 100644 --- a/src-wireless/net-auto +++ b/src-wireless/net-auto @@ -28,7 +28,7 @@ case "$1" in fi unset auto fi - done + done ;; stop) if ck_daemon net-auto; then @@ -48,4 +48,4 @@ case "$1" in exit_stderr "Usage: $0 {start|stop|restart}" esac -# vim: set ts=4 et sw=4: +# vim: ft=sh ts=4 et sw=4: diff --git a/src-wireless/netcfg-auto-wireless b/src-wireless/netcfg-auto-wireless index e3c9727..892d5a8 100644 --- a/src-wireless/netcfg-auto-wireless +++ b/src-wireless/netcfg-auto-wireless @@ -17,67 +17,67 @@ wifi_auto() set_rf_state "$interface" up fi - set_interface up "$interface" # uses iproute methods---is it there any value to providing option to use ifconfig? + set_interface up "$interface" # uses iproute methods---is it there any value to providing option to use ifconfig? networks=$(list_networks "$interface") if [[ -z "$networks" ]]; then - set_interface forcedown "$interface" + set_interface forcedown "$interface" exit_fail "- No networks available." fi # Loop through all the found essid's, then find a matching profile. - local found_profile found_essid + local found_profile found_essid - # JP: add ability to use AP instead of ESSID - # JP: also, make ESSIDs in wireless-dbus CONNECTIONS a regexp instead of a literal + # JP: add ability to use AP instead of ESSID + # JP: also, make ESSIDs in wireless-dbus CONNECTIONS a regexp instead of a literal while read ap essid; do - while read network; do - ( - unset CONNECTION INTERFACE AP ESSID - load_profile "$network" - case "$CONNECTION" in - wireless-old|wireless|wireless-dbus) - if [[ "$interface" = "$INTERFACE" ]]; then - if [[ "$ap" == "$AP" ]]; then - exit 2 - elif [[ -z "$found_profile" ]]; then - if [[ "$CONNECTION" == wireless-dbus ]]; then - if expr match "$essid" "^$ESSID\$" 1>/dev/null; then - exit 1 - fi - elif [[ "$essid" == "$ESSID" ]]; then - exit 1 - fi - fi - fi - ;; - esac - exit 0 - ) - case $? in - 2) found_profile="$network" - found_essid="$essid" - break 2;; - 1) found_profile="$network" - found_essid="$essid" - ;; - esac - done < <(list_profiles) # avoid subshell we'd get by piping list_profiles to while read - done < "$networks" # avoid subshell; list_networks returns name of a tmp file - rm -f "$networks" # shouldn't we delete the tmp file? + while read network; do + ( + unset CONNECTION INTERFACE AP ESSID + load_profile "$network" + case "$CONNECTION" in + wireless-old|wireless|wireless-dbus) + if [[ "$interface" = "$INTERFACE" ]]; then + if [[ "$ap" == "$AP" ]]; then + exit 2 + elif [[ -z "$found_profile" ]]; then + if [[ "$CONNECTION" == wireless-dbus ]]; then + if expr match "$essid" "^$ESSID\$" 1>/dev/null; then + exit 1 + fi + elif [[ "$essid" == "$ESSID" ]]; then + exit 1 + fi + fi + fi + ;; + esac + exit 0 + ) + case $? in + 2) found_profile="$network" + found_essid="$essid" + break 2;; + 1) found_profile="$network" + found_essid="$essid" + ;; + esac + done < <(list_profiles) # avoid subshell we'd get by piping list_profiles to while read + done < "$networks" # avoid subshell; list_networks returns name of a tmp file + rm -f "$networks" # shouldn't we delete the tmp file? if [[ -n "$found_profile" ]]; then - report_success - if profile_up "$found_profile" "$found_essid"; then # JP: now we pass literal essid to profile_up as $2 - exit 0 - else - set_interface forcedown "$interface" - exit_fail "Couldn't connect profile $found_profile." - fi - else - set_interface forcedown "$interface" - exit_fail "No profiles matched the local networks." + report_success + if profile_up "$found_profile" "$found_essid"; then # JP: now we pass literal essid to profile_up as $2 + exit 0 + else + set_interface forcedown "$interface" + exit_fail "Couldn't connect profile $found_profile." + fi + else + set_interface forcedown "$interface" + exit_fail "No profiles matched the local networks." fi } @@ -90,3 +90,4 @@ if [[ -z "$1" ]]; then fi wifi_auto "$1" +# vim: ft=sh ts=4 et sw=4: -- cgit v1.2.3-24-g4f1b