FreeBSD/tools/tools/cxgbetool/cxgbetool.c
/*
 * Parse an argument sub-vector as a { <parameter name> <value> } ordered
 * tuple.  If the parameter name in the argument sub-vector does not match the
 * passed in parameter name, then a zero is returned for the function and no
 * parsing is performed.  If there is a match, then the value is parsed and
 * returned in the provided return value pointer.
 */
Parse an argument sub-vector as a {   } ordered
tuple.  If the parameter name in the argument sub-vector does not match the
passed in parameter name, then a zero is returned for the function and no
parsing is performed.  If there is a match, then the value is parsed and
returned in the provided return value pointer.
Parse an argument sub - vector as a { } ordered tuple . If the parameter name in the argument sub - vector does not match the passed in parameter name then a zero is returned for the function and no parsing is performed . If there is a match then the value is parsed and returned in the provided return value pointer .
static int
parse_val(const char *param, const char *args[], uint32_t *val)
{
	char *p;
	if (strcmp(param, args[0]) != 0)
		return (EINVAL);
	*val = strtoul(args[1], &p, 0);
	if (p > args[1] && p[0] == 0)
		return (0);
	warnx("parameter \"%s\" has bad \"value\" %s", args[0], args[1]);
	return (EINVAL);
}
static int parse_val ( const char * param , const char * args [ ] , uint32_t * val ) { char * p ; if ( strcmp ( param , args [ 0 ] ) != 0 ) return ( EINVAL ) ; * val = strtoul ( args [ 1 ] , & p , 0 ) ; if ( p > args [ 1 ] && p [ 0 ] == 0 ) return ( 0 ) ; warnx ( " \" \" \" \" " , args [ 0 ] , args [ 1 ] ) ; return ( EINVAL ) ; }
Parse an argument sub-vector as a { <parameter name> <value> } ordered
 tuple.
Parse an argument sub - vector as a { <parameter name > <value > } ordered tuple .