X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=scripts.git;a=blobdiff_plain;f=hotspot.sh;h=adcebb9e7ad8176e14032e0dfc21924aeff606de;hp=e3cac287ae3531caab3c10bfdcf651541cdf877f;hb=6a45dbe664eebcb3050d0c3dfe9856f7c5815aca;hpb=ea923a43955b6b07ebe087eef413dc27744d8c81 diff --git a/hotspot.sh b/hotspot.sh index e3cac28..adcebb9 100755 --- a/hotspot.sh +++ b/hotspot.sh @@ -81,8 +81,8 @@ function scan () { -e "s/Quality=\([0-9]*\).*$/QUALITY,\1/" \ -e "s/Encryption key:/ENCRYPTION,/" | \ awk 'BEGIN { FS="," } - { - if($1 == "ESSID") { essid=$2 } + { + if($1 == "ESSID") { essid=$2 } else if($1 == "AP") { ap=$2 } else if($1 == "QUALITY") { quality=$2; } else if($1 == "ENCRYPTION") { @@ -258,6 +258,8 @@ if [[ $1 == "-k" ]]; then exit 1 fi +trap cleanup-before-quit EXIT + stty_state=$(stty -g) trap sigint-handler SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM @@ -295,58 +297,56 @@ while [[ ${cont} == 1 ]]; do ;; "") - process-key "down" - ;; + process-key "down" + ;; "") - process-key "up" - ;; + process-key "up" + ;; "") #$'\033'") - current_keymap=escape - ;; + current_keymap=escape + ;; *) - ;; - esac - ;; + ;; + esac + ;; - escape) ################################################## - case ${CHAR} in - "$'\033'") + escape) ################################################## + case ${CHAR} in + "$'\033'") process-key "esc-esc" ;; - "[") + "[") current_keymap=cursor ;; - *) + *) current_keymap=default ;; - esac - ;; + esac + ;; - cursor) ################################################## + cursor) ################################################## - current_keymap=default + current_keymap=default - case ${CHAR} in - A) + case ${CHAR} in + A) process-key "up" ;; - B) + B) process-key "down" ;; - *) - ;; - esac - ;; - *) - echo "Unknown keymap. This is an internal and weird bug." - cont=0 - ;; - esac + ;; + esac + ;; - done + *) + echo "Unknown keymap. This is an internal and weird bug." + cont=0 + ;; + esac - cleanup-before-quit +done