diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-11-10 21:46:08 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-11-19 02:25:36 -0500 |
commit | ef1ff1b4f29762d1caf83dc2b65ccfc7cb96e140 (patch) | |
tree | f1ebb65eec6eb156a0fba737bcd5386af2a9ebfe /net/iwconfig.sh.BSD.in | |
parent | 0510c473d4cd9097401e3a7bc236b0121977b81d (diff) |
make shell math operations style more succulent
Convert the style:
var=$((${var} + 1))
to:
: $(( var += 1 ))
The latter is easier to read imo.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'net/iwconfig.sh.BSD.in')
-rw-r--r-- | net/iwconfig.sh.BSD.in | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/net/iwconfig.sh.BSD.in b/net/iwconfig.sh.BSD.in index 850d70b2..3acaf663 100644 --- a/net/iwconfig.sh.BSD.in +++ b/net/iwconfig.sh.BSD.in @@ -218,7 +218,7 @@ iwconfig_associate() sleep 1 [ ${timeout} -eq 0 ] && continue - i=$((${i} + 1)) + : $(( i += 1 )) [ ${i} -ge ${timeout} ] && { eend 1; return 1; } done @@ -252,13 +252,13 @@ iwconfig_scan() scan="$(LC_ALL=C ifconfig -v "${IFACE}" list scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")" while [ ${i} -lt 3 -a -z "${scan}" ] ; do scan="${scan}${scan:+ }$(LC_ALL=C ifconfig -v "${IFACE}" scan 2>/dev/null | sed -e "1 d" -e "s/$/'/g" -e "s/^/'/g")" - i=$((${i} + 1)) + : $(( i += 1 )) done APS=-1 eval set -- ${scan} for line in "$@" ; do - APS=$((${APS} + 1)) + : $(( APS += 1 )) set -- ${line} while true ; do case "$1" in @@ -276,7 +276,7 @@ iwconfig_scan() # Add 1000 for managed nodes as we prefer them to adhoc set -- $* case "$1" in - *E*) eval QUAL_${APS}=$((${quality} + 1000)) ;; + *E*) eval QUAL_${APS}=$(( quality + 1000 )) ;; *) eval QUAL_${APS}=\$quality ;; esac done @@ -290,7 +290,7 @@ iwconfig_scan() # Sort based on quality local i=0 k=1 a= b= x= t= while [ ${i} -lt ${APS} ] ; do - k=$((${i} + 1)) + : $(( k = i + 1 )) while [ ${k} -le ${APS} ] ; do eval a=\$QUALITY_${i} [ -z "${a}" ] && break @@ -302,15 +302,15 @@ iwconfig_scan() eval ${x}_${k}=\$t done fi - k=$((${k} + 1)) + : $(( k += 1 )) done - i=$((${i} + 1)) + : $(( i += 1 )) done # Strip any duplicates local i=0 k=1 a= b= while [ ${i} -lt ${APS} ] ; do - k=$((${i} + 1)) + : $(( k = i + 1 )) while [ ${k} -le ${APS} ] ; do eval a=\$MAC_${i} eval b=\$MAC_${k} @@ -327,9 +327,9 @@ iwconfig_scan() unset MAC_${k} SSID_${k} CHAN_${k} QUALITY_${k} CAPS_${k} fi fi - k=$((${k} + 1)) + : $(( k += 1 )) done - i=$((${i} + 1)) + : $(( i += 1 )) done local i=0 e= m= s= @@ -337,7 +337,7 @@ iwconfig_scan() while [ ${i} -le ${APS} ] ; do eval x=\$MAC_${i} if [ -z "${x}" ] ; then - i=$((${i} + 1)) + : $(( i += 1 )) continue fi @@ -374,7 +374,7 @@ iwconfig_scan() unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} CAPS_${i} fi done - i=$((${i} + 1)) + : $(( i += 1 )) done eoutdent return 0 @@ -396,7 +396,7 @@ iwconfig_force_preferred() found_AP=true break fi - i=$((${i} + 1)) + : $(( i += 1 )) done if ! ${found_AP} ; then SSID=${ssid} @@ -428,7 +428,7 @@ iwconfig_connect_preferred() iwconfig_associate "${mac}" \ "${chan}" "${caps}" && return 0 fi - i=$((${i} + 1)) + : $(( i += 1 )) done done @@ -442,7 +442,7 @@ iwconfig_connect_not_preferred() while [ ${i} -le ${APS} ] ; do eval e=\$SSID_${i} if [ -z "${e}" ] ; then - i=$((${i} + 1)) + : $(( i += 1 )) continue fi @@ -465,7 +465,7 @@ iwconfig_connect_not_preferred() iwconfig_associate "${mac}" \ "${chan}" "${caps}" && return 0 fi - i=$((${i} + 1)) + : $(( i += 1 )) done return 1 |