URI: 
       tcmd/auxstats: improve wireless interface name matcher in Linux - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 0ac2a105ae58e86a8d224020f0a3c43358312e66
   DIR parent e683bdfa76a5c2c54422a6bd2934b133d77ba610
  HTML Author: Nic <nicolagi@sdf.org>
       Date:   Sun, 17 Oct 2021 14:18:29 +0100
       
       cmd/auxstats: improve wireless interface name matcher in Linux
       
       Diffstat:
         M src/cmd/auxstats/Linux.c            |       5 ++++-
       
       1 file changed, 4 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/src/cmd/auxstats/Linux.c b/src/cmd/auxstats/Linux.c
       t@@ -1,6 +1,7 @@
        #include <u.h>
        #include <libc.h>
        #include <bio.h>
       +#include <regexp.h>
        #include "dat.h"
        
        void xapm(int);
       t@@ -235,10 +236,12 @@ void
        xwireless(int first)
        {
                static int fd = -1;
       +        static Reprog *wlan = nil;
                int i;
        
                if(first){
                        fd = open("/proc/net/wireless", OREAD);
       +                wlan = regcomp("^(wlan[0-9]+|wlp[0-9]+s[0-9]+):$");
                        return;
                }
        
       t@@ -247,7 +250,7 @@ xwireless(int first)
                        tokens(i);
                        if(ntok < 3)
                                continue;
       -                if(strcmp(tok[0], "wlan0:") == 0)
       +                if(regexec(wlan, tok[0], nil, 0) == 1)
                                Bprint(&bout, "802.11 =%lld 100\n", atoll(tok[2]));
                }
        }