summaryrefslogtreecommitdiffstats
path: root/src/wireless
diff options
context:
space:
mode:
authorJim Pryor <profjim@jimpryor.net>2009-09-14 05:43:34 +0200
committerJames Rayner <james@archlinux.org>2009-09-14 08:22:11 +0200
commit67f1b8fae53ebe22ad1a0557c0d7a1371b96cb0b (patch)
tree76a0ad11c1df8272d0815a9c6c8398953f4effa0 /src/wireless
parent820d9295b51e427f3e17c9e83227a127ef9b7631 (diff)
downloadnetctl-67f1b8fae53ebe22ad1a0557c0d7a1371b96cb0b.tar.gz
netctl-67f1b8fae53ebe22ad1a0557c0d7a1371b96cb0b.tar.xz
Tweaks while merging
* added various quotes * made some vars local * tweaked some [[ ]]s, including one broken one in netcfg-menu * s/ra0/$INTERFACE/ in ethernet-iproute and wireless Signed-off-by: Jim Pryor <profjim@jimpryor.net>
Diffstat (limited to 'src/wireless')
-rw-r--r--src/wireless50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/wireless b/src/wireless
index 4e66bfa..3592d5e 100644
--- a/src/wireless
+++ b/src/wireless
@@ -125,7 +125,7 @@ list_networks()
}
list_networks() {
- wpa_supplicant_scan_info $1 1,5
+ wpa_supplicant_scan_info "$1" 1,5
}
wpa_supplicant_scan_info() {
@@ -136,7 +136,7 @@ wpa_supplicant_scan_info() {
[[ -z "$INTERFACE" ]] && return 1
essids=$(mktemp --tmpdir essid.XXXXXXXX)
- wpa_supplicant -B -i$INTERFACE -Dwext -C/var/run/wpa_supplicant -P/var/run/wpa_supplicant.pid
+ wpa_supplicant -B -i"$INTERFACE" -Dwext -C/var/run/wpa_supplicant -P/var/run/wpa_supplicant.pid
wpa_cli -i "$INTERFACE" scan &> /dev/null
sleep 2.5
wpa_cli -i "$INTERFACE" scan_results |
@@ -145,7 +145,7 @@ wpa_supplicant_scan_info() {
sort -rn -k3 |
sort -u -k5 |
sort -rn -k3 |
- cut -f$fields > "$essids"
+ cut -f"$fields" > "$essids"
# Fields are tab delimited
# Remove extraneous output from wpa_cli
@@ -154,7 +154,7 @@ wpa_supplicant_scan_info() {
# Re-sort by strength as the removal disorders the list
# Cut to the AP/essid fields only
- kill $(cat /var/run/wpa_supplicant.pid)
+ kill "$(cat /var/run/wpa_supplicant.pid)"
# File of 0 length, ie. no ssid's.
if [[ ! -s "$essids" ]]; then
@@ -167,37 +167,37 @@ wpa_supplicant_scan_info() {
}
set_rf_state() {
- local INTERFACE=$1 state=$2 PROFILE=$3
+ local INTERFACE="$1" state="$2" PROFILE="$3"
- source $IFACE_DIR/$INTERFACE
- [[ $PROFILE ]] && source $PROFILE_DIR/$PROFILE # profile overrides
+ source "$IFACE_DIR/$INTERFACE"
+ [[ -n "$PROFILE" ]] && source "$PROFILE_DIR/$PROFILE" # profile overrides
[[ $RFKILL == "hard" ]] && report_fail "Cannot set state on hardware rfkill switch"
- path=$(get_rf_path $INTERFACE $RFKILL_NAME)
- case $state in
+ local path=$(get_rf_path "$INTERFACE" "$RFKILL_NAME")
+ case "$state" in
up)
- echo 1 > $path/state
+ echo 1 > "$path/state"
;;
down)
- echo 0 > $path/state
+ echo 0 > "$path/state"
;;
esac
}
get_rf_path() {
- local INTERFACE=$1 RFKILL_NAME=$2
+ local INTERFACE="$1" RFKILL_NAME="$2" path
- if [[ $RFKILL_NAME ]]; then
+ if [[ -n "$RFKILL_NAME" ]]; then
for path in /sys/class/rfkill/*; do
- if [[ "$(cat $path/name)" == $RFKILL_NAME ]]; then
- echo $path
+ if [[ "$(cat "$path/name")" == "$RFKILL_NAME" ]]; then
+ echo "$path"
return 0
fi
done
report_fail "no rfkill switch with name $RFKILL_NAME"
else
- path=/sys/class/net/$INTERFACE/rfkill
- if [[ -d $path ]]; then
- echo $path
+ path="/sys/class/net/$INTERFACE/rfkill"
+ if [[ -d "$path" ]]; then
+ echo "$path"
return 0
fi
report_fail "no rfkill switch available on interface $INTERFACE"
@@ -205,19 +205,19 @@ get_rf_path() {
}
get_rf_state() {
- local INTERFACE=$1 PROFILE=$2
- source $IFACE_DIR/$INTERFACE
- [[ $PROFILE ]] && source $PROFILE_DIR/$PROFILE # profile overrides
- path=$(get_rf_path $INTERFACE $RFKILL_NAME)
- state=$(cat $path/state)
+ local INTERFACE="$1" PROFILE="$2" path state
+ source "$IFACE_DIR/$INTERFACE"
+ [[ -n "$PROFILE" ]] && source "$PROFILE_DIR/$PROFILE" # profile overrides
+ path=$(get_rf_path "$INTERFACE" "$RFKILL_NAME")
+ state=$(cat "$path/state")
- case $state in
+ case "$state" in
0)
echo "disabled";;
1)
echo "enabled";;
*)
- echo $state;;
+ echo "$state";;
esac
}