diff options
Diffstat (limited to 'apps/systemcmds')
-rw-r--r-- | apps/systemcmds/param/param.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/systemcmds/param/param.c b/apps/systemcmds/param/param.c index 92313e45a..53f9c365e 100644 --- a/apps/systemcmds/param/param.c +++ b/apps/systemcmds/param/param.c @@ -59,7 +59,7 @@ __EXPORT int param_main(int argc, char *argv[]); static void do_save(const char* param_file_name); static void do_load(const char* param_file_name); static void do_import(const char* param_file_name); -static void do_show(void); +static void do_show(const char* search_string); static void do_show_print(void *arg, param_t param); int @@ -99,10 +99,12 @@ param_main(int argc, char *argv[]) warnx("selected parameter file %s", param_get_default_file()); } - if (!strcmp(argv[1], "show")) { - do_show(); - } - + if (!strcmp(argv[1], "show")) + if (argc >= 3) { + do_show(argv[2]); + } else { + do_show(NULL); + } } errx(1, "expected a command, try 'load', 'import', 'show', 'select' or 'save'"); @@ -170,10 +172,10 @@ do_import(const char* param_file_name) } static void -do_show(void) +do_show(const char* search_string) { printf(" + = saved, * = unsaved\n"); - param_foreach(do_show_print, NULL, false); + param_foreach(do_show_print, search_string, false); exit(0); } @@ -183,6 +185,11 @@ do_show_print(void *arg, param_t param) { int32_t i; float f; + const char *search_string = (const char*)arg; + + /* print nothing if search string valid and not matching */ + if (arg != NULL && (strcmp(search_string, param_name(param) != 0))) + return; printf("%c %s: ", param_value_unsaved(param) ? '*' : (param_value_is_default(param) ? ' ' : '+'), |