From patchwork Thu Aug 24 11:19:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] fff-web: Fix two bugs in wifiscan.html From: Adrian Schmutzler X-Patchwork-Id: 452 X-Patchwork-Delegate: freifunk@adrianschmutzler.de Message-Id: <1503573543-1858-1-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Thu, 24 Aug 2017 13:19:02 +0200 Bug 1: If devices with hidden SSID are present, the matched SSID in the awk contains the newline (="unknown\n\t"). This destroys the table after the sort. Bug 2: If SSIDs contain ampersands (yes, people do that), they are now converted to &. Signed-off-by: Adrian Schmutzler Tested-by: Adrian Schmutzler --- src/packages/fff/fff-web/files/www/ssl/cgi-bin/wifiscan.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/wifiscan.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/wifiscan.html index a235159..254c24b 100755 --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/wifiscan.html +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/wifiscan.html @@ -18,8 +18,8 @@ <% iwinfo w2mesh scan |\ awk -v RS='' \ - '{r = gensub(/.*Address: ([0-9A-F:]*)?.*ESSID: "?(unknown|[^"]*)"?.*Mode: ([^ ]*).*Channel: ([0-9]*).*Signal: (-[0-9]*) dBm.*Encryption: ([^"]*).*/, \ - "\\2\\4\\5 dBm\\3\\1\\6", "g"); print r;}' | sort -n + '{r = gensub(/.*Address: ([0-9A-F:]*)?.*ESSID: "?(unknown|[^"]*)"?[ ]*\n.*Mode: ([^ ]*).*Channel: ([0-9]*).*Signal: (-[0-9]*) dBm.*Encryption: ([^"]*).*/, \ + "\\2\\4\\5 dBm\\3\\1\\6", "g"); print r;}' | sort -n | sed 's#&#\&#' # The HTML comment contains the signal quality to allow sorting %>