Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Apr 2017 22:34:45 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317304 - head/tools/regression/geom_gpt
Message-ID:  <201704222234.v3MMYjSj025412@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat Apr 22 22:34:45 2017
New Revision: 317304
URL: https://svnweb.freebsd.org/changeset/base/317304

Log:
  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

Modified:
  head/tools/regression/geom_gpt/gctl_test_helper.c

Modified: head/tools/regression/geom_gpt/gctl_test_helper.c
==============================================================================
--- head/tools/regression/geom_gpt/gctl_test_helper.c	Sat Apr 22 22:05:23 2017	(r317303)
+++ head/tools/regression/geom_gpt/gctl_test_helper.c	Sat Apr 22 22:34:45 2017	(r317304)
@@ -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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704222234.v3MMYjSj025412>