Fix iwconfig parsing on Linux, #111 thanks to Andrew Gaffney.

This commit is contained in:
Roy Marples 2008-09-04 14:54:56 +00:00
parent 00d010fbe0
commit 93a3b2dd02

View File

@ -433,7 +433,7 @@ iwconfig_scan()
[ -z "${a}" ] && break [ -z "${a}" ] && break
eval b=\$QUALITY_${k} eval b=\$QUALITY_${k}
if [ -n "${b}" -a "${a}" -lt "${b}" ]; then if [ -n "${b}" -a "${a}" -lt "${b}" ]; then
for x in MAC SSID CHAN QUALITY ENC; do for x in MAC SSID MODE CHAN QUALITY ENC; do
eval t=\$${x}_${i} eval t=\$${x}_${i}
eval ${x}_${i}=\$${x}_${k} eval ${x}_${i}=\$${x}_${k}
eval ${x}_${k}=\$t eval ${x}_${k}=\$t
@ -457,7 +457,7 @@ iwconfig_scan()
local u=${k} local u=${k}
# We need to split this into two tests, otherwise bash errors # We need to split this into two tests, otherwise bash errors
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i} [ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
unset MAC_${u} SSID_${u} CHAN_${u} QUALITY_${u} ENC_${u} unset MAC_${u} SSID_${u} MODE_${u} CHAN_${u} QUALITY_${u} ENC_${u}
fi fi
k=$((${k} + 1)) k=$((${k} + 1))
done done
@ -503,7 +503,7 @@ iwconfig_scan()
for x; do for x; do
if [ "${x}" = "${s}" ]; then if [ "${x}" = "${s}" ]; then
ewarn "${s} has been blacklisted - not connecting" ewarn "${s} has been blacklisted - not connecting"
unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} ENC_${i} unset SSID_${i} MAC_${i} ${MODE}_${i} CHAN_${i} QUALITY_${i} ENC_${i}
fi fi
done done
i=$((${i} + 1)) i=$((${i} + 1))