Example #1
0
/*
 * clo_parse_str -- (internal) parse string value
 */
static int
clo_parse_str(struct benchmark_clo *clo, const char *arg,
		struct clo_vec *clovec)
{
	char *str = strdup(arg);
	assert(str != NULL);

	clo_vec_add_alloc(clovec, str);
	clo_vec_memcpy(clovec, clo->off, sizeof (str), &str);

	return 0;
}
Example #2
0
File: clo.cpp Project: ChandKV/nvml
/*
 * clo_parse_flag -- (internal) parse flag
 */
static int
clo_parse_flag(struct benchmark_clo *clo, const char *arg,
	       struct clo_vec *clovec)
{
	bool flag = true;
	if (arg != NULL) {
		if (strcmp(arg, "true") == 0)
			flag = true;
		else if (strcmp(arg, "false") == 0)
			flag = false;
		else
			return -1;
	}

	return clo_vec_memcpy(clovec, clo->off, sizeof(flag), &flag);
}