Changed netif name formatting from %s to %c%c.

This commit is contained in:
likewise 2003-04-15 14:32:13 +00:00
parent a1efd95d0f
commit 4ecb01f4fd

View File

@ -73,7 +73,7 @@ netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask,
/* allocate netif structure */ /* allocate netif structure */
netif = mem_malloc(sizeof(struct netif)); netif = mem_malloc(sizeof(struct netif));
if(netif == NULL) { if (netif == NULL) {
DEBUGF(NETIF_DEBUG, ("netif_add(): out of memory for netif\n")); DEBUGF(NETIF_DEBUG, ("netif_add(): out of memory for netif\n"));
return NULL; return NULL;
} }
@ -119,38 +119,34 @@ netif_set_addr(struct netif *netif,struct ip_addr *ipaddr, struct ip_addr *netma
netif_set_gw(netif, gw); netif_set_gw(netif, gw);
} }
/*-----------------------------------------------------------------------------------*/
void netif_remove(struct netif * netif) void netif_remove(struct netif * netif)
{ {
if ( netif == NULL ) return; if ( netif == NULL ) return;
/* is it the first netif? */ /* is it the first netif? */
if(netif_list == netif) { if (netif_list == netif) {
netif_list = netif->next; netif_list = netif->next;
} }
else else {
{
/* look for netif further down the list */ /* look for netif further down the list */
struct netif * tmpNetif; struct netif * tmpNetif;
for(tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) { for (tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) {
if(tmpNetif->next == netif) { if (tmpNetif->next == netif) {
tmpNetif->next = netif->next; tmpNetif->next = netif->next;
break; break;
} }
} }
if(tmpNetif == NULL) if (tmpNetif == NULL)
return; /* we didn't find any netif today */ return; /* we didn't find any netif today */
} }
/* this netif is default? */ /* this netif is default? */
if (netif_default == netif) if (netif_default == netif)
/* reset default netif */ /* reset default netif */
netif_default = NULL; netif_default = NULL;
DEBUGF( NETIF_DEBUG, ("netif_remove: removed netif\n") );
DEBUGF(NETIF_DEBUG, ("netif_remove: removed netif\n"));
mem_free( netif ); mem_free( netif );
} }
/*-----------------------------------------------------------------------------------*/
struct netif * struct netif *
netif_find(char *name) netif_find(char *name)
{ {
@ -167,11 +163,11 @@ netif_find(char *name)
if(num == netif->num && if(num == netif->num &&
name[0] == netif->name[0] && name[0] == netif->name[0] &&
name[1] == netif->name[1]) { name[1] == netif->name[1]) {
DEBUGF(NETIF_DEBUG, ("netif_find: found %s\n", name)); DEBUGF(NETIF_DEBUG, ("netif_find: found %c%c\n", name[0], name[1]));
return netif; return netif;
} }
} }
DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %s\n", name)); DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
return NULL; return NULL;
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/