1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

gctl_test_helper: add diagnostic output for parse_retval(..)

This will help end-users better diagnose issues with the function.

MFC after:	5 weeks
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Enji Cooper 2017-04-22 22:34:45 +00:00
parent 22c00e3b85
commit 29924a1c12
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317304

View File

@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
@ -113,7 +114,7 @@ main(int argc, char *argv[])
struct gctl_req *req;
char *param, *value;
const char *s;
int c, len;
int c, len, parse_retval;
req = gctl_get_handle();
assert(req != NULL);
@ -132,8 +133,9 @@ main(int argc, char *argv[])
}
}
while (optind < argc) {
if (!parse(argv[optind++], &param, &value, &len)) {
for (; optind < argc; optind++) {
parse_retval = parse(argv[optind], &param, &value, &len);
if (parse_retval == 0) {
if (len > 0) {
rv = malloc(sizeof(struct retval));
assert(rv != NULL);
@ -144,7 +146,9 @@ main(int argc, char *argv[])
gctl_rw_param(req, param, len, value);
} else
gctl_ro_param(req, param, -1, value);
}
} else
warnc(parse_retval, "failed to parse argument (%s)",
argv[optind]);
}
if (verbose)