FreeBSD/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c
/*
 * Given two bridge interfaces' system indexes, find their
 * corresponding names and return the result of the name
 * comparison. Returns:
 * error : -2
 * i1 < i2 : -1
 * i1 > i2 : +1
 * i1 = i2 : 0
 */
Given two bridge interfaces' system indexes, find their
corresponding names and return the result of the name
comparison.
Given two bridge interfaces ' system indexes find their corresponding names and return the result of the name comparison .
int
bridge_compare_sysidx(uint32_t i1, uint32_t i2)
{
	int c;
	const char *b1, *b2;
	if (i1 == i2)
		return (0);
	if ((b1 = bridge_if_find_name(i1)) == NULL) {
		syslog(LOG_ERR, "Bridge interface %d does not exist", i1);
		return (-2);
	}
	if ((b2 = bridge_if_find_name(i2)) == NULL) {
		syslog(LOG_ERR, "Bridge interface %d does not exist", i2);
		return (-2);
	}
	if ((c = strcmp(b1, b2)) < 0)
		return (-1);
	else if (c > 0)
		return (1);
	return (0);
}
int bridge_compare_sysidx ( uint32_t i1 , uint32_t i2 ) { int c ; const char * b1 , * b2 ; if ( i1 == i2 ) return ( 0 ) ; if ( ( b1 = bridge_if_find_name ( i1 ) ) == NULL ) { syslog ( LOG_ERR , " " , i1 ) ; return ( -2 ) ; } if ( ( b2 = bridge_if_find_name ( i2 ) ) == NULL ) { syslog ( LOG_ERR , " " , i2 ) ; return ( -2 ) ; } if ( ( c = strcmp ( b1 , b2 ) ) < 0 ) return ( -1 ) ; else if ( c > 0 ) return ( 1 ) ; return ( 0 ) ; }
Given two bridge interfaces' system indexes, find their
 corresponding names and return the result of the name
 comparison.
Given two bridge interfaces ' system indexes find their corresponding names and return the result of the name comparison .