---
 wmifinfo/Changelog  |  8 +++++++-
 wmifinfo/Makefile   |  7 +++++--
 wmifinfo/README     |  3 ++-
 wmifinfo/nwn.c      |  2 ++
 wmifinfo/wmifinfo.c | 50 +++++++++++++++++++++++++++++++++++++++-----------
 wmifinfo/xutils.c   |  5 +++--
 6 files changed, 58 insertions(+), 17 deletions(-)

diff --git a/wmifinfo/Changelog b/wmifinfo/Changelog
index 23710b4..4688faf 100644
--- a/wmifinfo/Changelog
+++ b/wmifinfo/Changelog
@@ -32,9 +32,15 @@
 
 0.06   Added openBSD support
        
-       - Peter Stromberg <[email protected]> supplied a patch for
+       - Peter Stromberg <wilfried at openbsd dot org> supplied a patch for
          OpenBSD support. I have not tried this myself since I don't have
          access to this OS. I will probably split the code into several
          OS-dependend modules later, for now the main .c file has some
          #ifdefs for linux and OpenBSD.
 
+
+0.07   New feature
+
+       - On request of Jesper Anderson <jesper at pobox dot com>, wmifinfo
+         now always switches to new interfaces when they become available;
+         handy for new established PPP links or inserted PCMCIA cards
diff --git a/wmifinfo/Makefile b/wmifinfo/Makefile
index 009e7f5..ddb2121 100644
--- a/wmifinfo/Makefile
+++ b/wmifinfo/Makefile
@@ -9,7 +9,7 @@ ENABLE_NWN_SUPPORT=n
 # Nothing to configure under here
 
 NAME=wmifinfo
-VERSION=0.06
+VERSION=0.07
 
 CC = gcc
 LD = gcc
@@ -40,4 +40,7 @@ install:
        cp $(BIN) $(BINDIR)
 
 dist:  clean
-       cd .. && tar -zcvf dist/wmifinfo-$(VERSION).tgz wmifinfo-$(VERSION)/
+       rm -rf /tmp/wmifinfo-$(VERSION)
+       cd .. && cp -a wmifinfo /tmp/wmifinfo-$(VERSION)
+       cd /tmp && tar --exclude CVS -zcvf wmifinfo-$(VERSION).tgz 
wmifinfo-$(VERSION)/
+       
diff --git a/wmifinfo/README b/wmifinfo/README
index e3543f9..1329b77 100644
--- a/wmifinfo/README
+++ b/wmifinfo/README
@@ -90,6 +90,7 @@ COPYRIGHT
 
   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
 
     
\ No newline at end of file
diff --git a/wmifinfo/nwn.c b/wmifinfo/nwn.c
index 4278127..6c23c64 100644
--- a/wmifinfo/nwn.c
+++ b/wmifinfo/nwn.c
@@ -4,6 +4,8 @@
  * cards. Since there seems to be no official range for the 'Quality' value I 
assume
  * it's between 0 and 15, and multiply by 4 to get the range 0-63...
  *
+ * $Id: nwn.c,v 1.2 2002/09/15 14:31:41 ico Exp $
+ *
  */
 
 #ifdef ENABLE_NWN_SUPPORT
diff --git a/wmifinfo/wmifinfo.c b/wmifinfo/wmifinfo.c
index 9c6b8a7..f390123 100644
--- a/wmifinfo/wmifinfo.c
+++ b/wmifinfo/wmifinfo.c
@@ -1,4 +1,7 @@
-        
+/*
+ * $Id: wmifinfo.c,v 1.3 2004/03/03 18:29:50 ico Exp $
+ */
+        
 #include <stdio.h>
 #include <unistd.h>
 #ifdef linux
@@ -630,10 +633,6 @@ void addifname(char *name)
 
        strcpy(ifname[ifaces], name);
        
-       if(strcasecmp(name, startif) == 0) {
-               ifno = ifaces;
-               startif[0] = 0;
-       }
        
        ifaces++;
        
@@ -647,14 +646,24 @@ void addifname(char *name)
  
 void getifnames(void)
 {      
+       char pifname[MAXIFS][16];
+       int pifaces;
+       int i,j;
+       int isnew;
+       
+       /* 
+        * Copy list of interface names and clean the old list
+        */
+        
+       for(i=0; i<ifaces; i++) strncpy(pifname[i], ifname[i], 
sizeof(pifname[i]));
+       pifaces = ifaces;
+       ifaces = 0;
+
 #ifdef linux
        FILE *f;
        char buf[128];
        char *p1, *p2;
        int ifcount;
-       int i;
-       
-       ifaces = 0;
        
        f = fopen("/proc/net/dev", "r");
        
@@ -689,14 +698,13 @@ void getifnames(void)
        for(i=0; i<ifcount; i++) {
                addifname(ifc.ifc_req[i].ifr_name);
        }
-#elif defined(__OpenBSD__)
+#endif
+#ifdef __OpenBSD__
        struct ifreq ibuf[32];
        struct ifconf ifc;
        struct ifreq *ifrp, *ifend;
        int r;
 
-       ifaces = 0;
-
        ifc.ifc_len = sizeof(ibuf);
        ifc.ifc_buf = (caddr_t) ibuf;
        if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) == -1 ||
@@ -719,4 +727,24 @@ void getifnames(void)
                ifrp = (struct ifreq *) ((char *) ifrp + r);
        }
 #endif
+
+       /*
+        * Check if the new list contains interfaces that were not in the old 
list. If a new
+        * interface is found, make it the current one to display. (-i will 
override)
+        */
+       
+       for(i=0; i<ifaces; i++) {
+               isnew = 1;
+               for(j=0; j<pifaces; j++) if(strcmp(ifname[i], pifname[j]) == 0) 
isnew = 0;
+               if(isnew) ifno = i;
+       }
+
+       for(i=0; i<ifaces; i++) {
+               if(strcasecmp(ifname[i], startif) == 0) {
+                       printf("whop\n");
+                       ifno = ifaces;
+                       startif[0] = 0;
+               }
+       }
+        
 }
diff --git a/wmifinfo/xutils.c b/wmifinfo/xutils.c
index 1f0df15..80a7afe 100644
--- a/wmifinfo/xutils.c
+++ b/wmifinfo/xutils.c
@@ -21,10 +21,11 @@
  *
  *      You should have received a copy of the GNU General Public License
  *      along with this program (see the file COPYING); if not, write to the
- *      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- *      Boston, MA 02110-1301 USA
+ *      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ *      Boston, MA  02111-1307, USA
  *
  *
+ * $Id: xutils.c,v 1.2 2002/09/15 14:31:41 ico Exp $
  *
  *
  */  
-- 
1.9.1


-- 
To unsubscribe, send mail to [email protected].

Reply via email to