sys/net/if_clone.c
static struct if_clone *
if_clone_lookup(const char *name, int *unitp)
{
	struct if_clone *ifc;
	const char *cp;
	int i;

	for (ifc = LIST_FIRST(&if_cloners); ifc != NULL;) {
		for (cp = name, i = 0; i < ifc->ifc_namelen; i++, cp++) {
			if (ifc->ifc_name[i] != *cp)
				goto next_ifc;
		}
		goto found_name;
 next_ifc:
		ifc = LIST_NEXT(ifc, ifc_list);
	}

	/* No match. */
	return (NULL);

 found_name:
	if (*cp == '\0') {
		i = -1;
	} else {
		for (i = 0; *cp != '\0'; cp++) {
			if (*cp < '0' || *cp > '9') {
				/* Bogus unit number. */
				return (NULL);
			}
			i = (i * 10) + (*cp - '0');
		}
	}

	if (unitp != NULL)
		*unitp = i;
	return (ifc);
}
/*
 * Look up a network interface cloner.
 */
Look up a network interface cloner.
Look up a network interface cloner .
static struct if_clone *
if_clone_lookup(const char *name, int *unitp)
{
	struct if_clone *ifc;
	const char *cp;
	int i;
	for (ifc = LIST_FIRST(&if_cloners); ifc != NULL;) {
		for (cp = name, i = 0; i < ifc->ifc_namelen; i++, cp++) {
			if (ifc->ifc_name[i] != *cp)
				goto next_ifc;
		}
		goto found_name;
 next_ifc:
		ifc = LIST_NEXT(ifc, ifc_list);
	}
	return (NULL);
 found_name:
	if (*cp == '\0') {
		i = -1;
	} else {
		for (i = 0; *cp != '\0'; cp++) {
			if (*cp < '0' || *cp > '9') {
				return (NULL);
			}
			i = (i * 10) + (*cp - '0');
		}
	}
	if (unitp != NULL)
		*unitp = i;
	return (ifc);
}
static struct if_clone * if_clone_lookup ( const char * name , int * unitp ) { struct if_clone * ifc ; const char * cp ; int i ; for ( ifc = LIST_FIRST ( & if_cloners ) ; ifc != NULL ; ) { for ( cp = name , i = 0 ; i < ifc -> ifc_namelen ; i ++ , cp ++ ) { if ( ifc -> ifc_name [ i ] != * cp ) goto next_ifc ; } goto found_name ; next_ifc : ifc = LIST_NEXT ( ifc , ifc_list ) ; } return ( NULL ) ; found_name : if ( * cp == ' \0 ' ) { i = -1 ; } else { for ( i = 0 ; * cp != ' \0 ' ; cp ++ ) { if ( * cp < ' ' || * cp > ' ' ) { return ( NULL ) ; } i = ( i * 10 ) + ( * cp - ' ' ) ; } } if ( unitp != NULL ) * unitp = i ; return ( ifc ) ; }
Look up a network interface cloner.
Look up a network interface cloner .
/* No match. */ /* Bogus unit number. */