From: Ola Olsson Date: Wed, 21 Oct 2015 12:13:19 +0000 (+0200) Subject: mesh: show mesh parameters when no args are given X-Git-Tag: v4.7~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33cbe6cdd261146a1ac69839aca295c547b95d38;p=thirdparty%2Fiw.git mesh: show mesh parameters when no args are given The help text in " 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 Signed-off-by: Johannes Berg --- 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);