Instead of ignoring SSIDs containing whitespaces, slightly adjust the
commands to take everything in between 'nwid ' and ' chan' as SSID; if
it has double quotes at start *and* end, simply remove those.

This enables users to select networks such as "Unitymedia WifiSpot"
"FRITZ!Box 7490" for example which are common among the quoted ones at
least here in germany.

The only SSIDs known to break this are those containing ' chan ' as this
substring is used as delimiter. Picking "some chan 4 me" would therefore
result in _nwid being assigned '"some' (literal double quote), but than
reasonably acceptable (compared to the current behaviour).


Since cat's -n flag already takes care of the space between numbers and
input lines, remove the leading tab to avoid excessive widths for lines
with long SSIDs.

Feedback/OK?

Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1014
diff -u -p -r1.1014 install.sub
--- install.sub 3 Jun 2017 22:27:41 -0000       1.1014
+++ install.sub 14 Jun 2017 22:06:47 -0000
@@ -1060,10 +1060,9 @@ v6_config() {
# Perform an 802.11 network scan on interface $1.
# The result is cached in $WLANLIST.
ieee80211_scan() {
-       # N.B. Skipping quoted nwid's for now.
        [[ -f $WLANLIST ]] ||
                ifconfig $1 scan |
-               sed -n 's/^             nwid \([^"]\)/\1/p' >$WLANLIST
+                       sed -n 's/^[[:space:]]*nwid //p' >$WLANLIST
        cat $WLANLIST
}

@@ -1078,15 +1077,16 @@ ieee80211_config() {
        # Empty scan cache.
        rm -f $WLANLIST

-       while [[ -z $_nwid ]]; do
+       while [[ -z "$_nwid" ]]; do
                ask_until "Access point? (ESSID, 'any', list# or '?')" "any"
                case "$resp" in
                +([0-9]))
-                       _nwid=$(ieee80211_scan $_if | sed -n "${resp}s/ .*//p")
+                       _nwid=$(ieee80211_scan $_if | sed -n ${resp}'{s/ chan 
.*//p;q;}')
                        [[ -z $_nwid ]] && echo "There is no line $resp."
+                       [[ $_nwid = \"*\" ]] && _nwid=${_nwid#\"} 
_nwid=${_nwid%\"}
                        ;;
                \?)     ieee80211_scan $_if |
-                               sed -n 's/^\([^ ]*\) chan .* bssid \([^ ]*\) 
.*$/       \1 (\2)/p' |
+                               sed -n 's/^\(.*\) chan .* bssid \([^ ]*\) 
.*$/\1 (\2)/p' |
                                cat -n | more -c
                        ;;
                *)      _nwid=$resp

Reply via email to