FreeBSD/tools/tools/cxgbtool/cxgbtool.c
/*
 * Parse a string containing a value and an optional colon separated mask.
 */
Parse a string containing a value and an optional colon separated mask.
Parse a string containing a value and an optional colon separated mask .
static int
parse_val_mask_param(const char *s, uint32_t *val, uint32_t *mask,
    uint32_t default_mask)
{
	char *p;
	*mask = default_mask;
	*val = strtoul(s, &p, 0);
	if (p == s || *val > default_mask)
		return -1;
	if (*p == ':' && p[1])
		*mask = strtoul(p + 1, &p, 0);
	return *p || *mask > default_mask ? -1 : 0;
}
static int parse_val_mask_param ( const char * s , uint32_t * val , uint32_t * mask , uint32_t default_mask ) { char * p ; * mask = default_mask ; * val = strtoul ( s , & p , 0 ) ; if ( p == s || * val > default_mask ) return -1 ; if ( * p == ' ' && p [ 1 ] ) * mask = strtoul ( p + 1 , & p , 0 ) ; return * p || * mask > default_mask ? -1 : 0 ; }
Parse a string containing a value and an optional colon separated mask.
Parse a string containing a value and an optional colon separated mask .