wmifinfo: bump to version 0.7.
This commit is contained in:
		
							parent
							
								
									36febff3d5
								
							
						
					
					
						commit
						f938426084
					
				
					 6 changed files with 58 additions and 17 deletions
				
			
		| 
						 | 
					@ -32,9 +32,15 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
0.06	Added openBSD support
 | 
					0.06	Added openBSD support
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	- Peter Stromberg <wilfried@openbsd.org> 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
 | 
						  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
 | 
						  access to this OS. I will probably split the code into several
 | 
				
			||||||
	  OS-dependend modules later, for now the main .c file has some
 | 
						  OS-dependend modules later, for now the main .c file has some
 | 
				
			||||||
	  #ifdefs for linux and OpenBSD.
 | 
						  #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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ ENABLE_NWN_SUPPORT=n
 | 
				
			||||||
# Nothing to configure under here
 | 
					# Nothing to configure under here
 | 
				
			||||||
 | 
					
 | 
				
			||||||
NAME=wmifinfo
 | 
					NAME=wmifinfo
 | 
				
			||||||
VERSION=0.06
 | 
					VERSION=0.07
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CC = gcc
 | 
					CC = gcc
 | 
				
			||||||
LD = gcc
 | 
					LD = gcc
 | 
				
			||||||
| 
						 | 
					@ -40,4 +40,7 @@ install:
 | 
				
			||||||
	cp $(BIN) $(BINDIR)
 | 
						cp $(BIN) $(BINDIR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dist:	clean
 | 
					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)/
 | 
				
			||||||
 | 
						
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,6 +90,7 @@ COPYRIGHT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  You should have received a copy of the GNU General Public License along
 | 
					  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.,
 | 
					  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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,8 @@
 | 
				
			||||||
 * cards. Since there seems to be no official range for the 'Quality' value I assume
 | 
					 * 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...
 | 
					 * 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
 | 
					#ifdef ENABLE_NWN_SUPPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,7 @@
 | 
				
			||||||
	 
 | 
					/*
 | 
				
			||||||
 | 
					 * $Id: wmifinfo.c,v 1.3 2004/03/03 18:29:50 ico Exp $
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					 	 
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
#ifdef linux
 | 
					#ifdef linux
 | 
				
			||||||
| 
						 | 
					@ -630,10 +633,6 @@ void addifname(char *name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	strcpy(ifname[ifaces], name);
 | 
						strcpy(ifname[ifaces], name);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if(strcasecmp(name, startif) == 0) {
 | 
					 | 
				
			||||||
		ifno = ifaces;
 | 
					 | 
				
			||||||
		startif[0] = 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	ifaces++;
 | 
						ifaces++;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					@ -647,14 +646,24 @@ void addifname(char *name)
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
void getifnames(void)
 | 
					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
 | 
					#ifdef linux
 | 
				
			||||||
	FILE *f;
 | 
						FILE *f;
 | 
				
			||||||
	char buf[128];
 | 
						char buf[128];
 | 
				
			||||||
	char *p1, *p2;
 | 
						char *p1, *p2;
 | 
				
			||||||
	int ifcount;
 | 
						int ifcount;
 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	ifaces = 0;
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	f = fopen("/proc/net/dev", "r");
 | 
						f = fopen("/proc/net/dev", "r");
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					@ -689,14 +698,13 @@ void getifnames(void)
 | 
				
			||||||
	for(i=0; i<ifcount; i++) {
 | 
						for(i=0; i<ifcount; i++) {
 | 
				
			||||||
		addifname(ifc.ifc_req[i].ifr_name);
 | 
							addifname(ifc.ifc_req[i].ifr_name);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#elif defined(__OpenBSD__)
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef __OpenBSD__
 | 
				
			||||||
	struct ifreq ibuf[32];
 | 
						struct ifreq ibuf[32];
 | 
				
			||||||
	struct ifconf ifc;
 | 
						struct ifconf ifc;
 | 
				
			||||||
	struct ifreq *ifrp, *ifend;
 | 
						struct ifreq *ifrp, *ifend;
 | 
				
			||||||
	int r;
 | 
						int r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ifaces = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ifc.ifc_len = sizeof(ibuf);
 | 
						ifc.ifc_len = sizeof(ibuf);
 | 
				
			||||||
	ifc.ifc_buf = (caddr_t) ibuf;
 | 
						ifc.ifc_buf = (caddr_t) ibuf;
 | 
				
			||||||
	if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) == -1 ||
 | 
						if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) == -1 ||
 | 
				
			||||||
| 
						 | 
					@ -719,4 +727,24 @@ void getifnames(void)
 | 
				
			||||||
		ifrp = (struct ifreq *) ((char *) ifrp + r);
 | 
							ifrp = (struct ifreq *) ((char *) ifrp + r);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#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;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						 
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,10 +21,11 @@
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *      You should have received a copy of the GNU General Public License
 | 
					 *      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
 | 
					 *      along with this program (see the file COPYING); if not, write to the
 | 
				
			||||||
 *      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 | 
					 *      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 | 
				
			||||||
 *      Boston, MA 02110-1301 USA
 | 
					 *      Boston, MA  02111-1307, USA
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 | 
					 * $Id: xutils.c,v 1.2 2002/09/15 14:31:41 ico Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 */  
 | 
					 */  
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue