]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
mesh parameter list improvements
authorJohannes Berg <johannes@sipsolutions.net>
Thu, 29 Jan 2009 13:56:08 +0000 (14:56 +0100)
committerJohannes Berg <johannes@sipsolutions.net>
Thu, 29 Jan 2009 13:56:08 +0000 (14:56 +0100)
 - list them as a real list
 - print them out when the user specified none at all

mesh.c

diff --git a/mesh.c b/mesh.c
index f66336322392673cae451484891d4f42dfe6f350..932196e82fccd35383fa53f3718e62c7d659351a 100644 (file)
--- a/mesh.c
+++ b/mesh.c
@@ -170,12 +170,11 @@ const static struct mesh_param_descr _mesh_param_descrs[] =
 static void print_all_mesh_param_descr(void)
 {
        int i;
-       const char *comma = "";
 
-       for (i = 0; i < ARRAY_SIZE(_mesh_param_descrs); i++) {
-               printf("%s%s", comma, _mesh_param_descrs[i].name);
-               comma = ", ";
-       }
+       printf("Possible mesh parameters are:\n");
+
+       for (i = 0; i < ARRAY_SIZE(_mesh_param_descrs); i++)
+               printf(" - %s\n", _mesh_param_descrs[i].name);
 }
 
 static const struct mesh_param_descr* find_mesh_param(int argc, char **argv,
@@ -187,6 +186,7 @@ static const struct mesh_param_descr* find_mesh_param(int argc, char **argv,
        if (argc < 1) {
                printf("You must specify which mesh parameter to %s.\n",
                       action_name);
+               print_all_mesh_param_descr();
                return NULL;
        }
 
@@ -198,9 +198,7 @@ static const struct mesh_param_descr* find_mesh_param(int argc, char **argv,
        }
 
        if (!mdescr) {
-               printf("Mesh_param must be one of: ");
                print_all_mesh_param_descr();
-               printf("\n");
                return NULL;
        }
        return mdescr;