Search Linux Wireless

[PATCH] mesh: show mesh parameters when no args are given

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The help text in "<get|set> mesh_param" says that
available parameters will be shown if no args are given
but that is not the case - fix that.

Also, add help text if a parameter is given but not found.

Signed-off-by: Ola Olsson <ola.olsson@xxxxxxxxxxxxxx>
---
 mesh.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/mesh.c b/mesh.c
index 460d0c9..f2415f3 100644
--- a/mesh.c
+++ b/mesh.c
@@ -286,7 +286,6 @@ static const struct mesh_param_descr *find_mesh_param(const char *name)
 			return _mesh_param_descrs + i;
 	}
 
-	print_all_mesh_param_descr();
 	return NULL;
 }
 
@@ -305,8 +304,10 @@ static int set_interface_meshparam(struct nl80211_state *state,
 	if (!container)
 		return -ENOBUFS;
 
-	if (!argc)
+	if (!argc) {
+		print_all_mesh_param_descr();
 		return 1;
+	}
 
 	while (argc) {
 		const char *name;
@@ -334,8 +335,11 @@ static int set_interface_meshparam(struct nl80211_state *state,
 		}
 
 		mdescr = find_mesh_param(name);
-		if (!mdescr)
+		if (!mdescr) {
+			printf("Could not find the parameter %s.\n", name);
+			print_all_mesh_param_descr();
 			return 2;
+		}
 
 		/* Parse the new value */
 		ret = mdescr->parse_fn(value, &any);
@@ -411,13 +415,18 @@ static int get_interface_meshparam(struct nl80211_state *state,
 {
 	const struct mesh_param_descr *mdescr = NULL;
 
-	if (argc > 1)
+	if (argc == 0) {
+		print_all_mesh_param_descr();
 		return 1;
-
-	if (argc == 1) {
+	} else if (argc == 1) {
 		mdescr = find_mesh_param(argv[0]);
-		if (!mdescr)
+		if (!mdescr) {
+			printf("Could not find the parameter %s.\n", argv[0]);
+			print_all_mesh_param_descr();
 			return 2;
+		}
+	} else {
+		return 1;
 	}
 
 	register_handler(print_mesh_param_handler, (void *)mdescr);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux