|
|
|
@ -61,7 +61,7 @@ static void do_load(const char* param_file_name);
@@ -61,7 +61,7 @@ static void do_load(const char* param_file_name);
|
|
|
|
|
static void do_import(const char* param_file_name); |
|
|
|
|
static void do_show(const char* search_string); |
|
|
|
|
static void do_show_print(void *arg, param_t param); |
|
|
|
|
static void do_set(const char* name, const char* val); |
|
|
|
|
static void do_set(const char* name, const char* val, bool fail_on_not_found); |
|
|
|
|
static void do_compare(const char* name, const char* vals[], unsigned comparisons); |
|
|
|
|
static void do_reset(); |
|
|
|
|
|
|
|
|
@ -117,10 +117,17 @@ param_main(int argc, char *argv[])
@@ -117,10 +117,17 @@ param_main(int argc, char *argv[])
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!strcmp(argv[1], "set")) { |
|
|
|
|
if (argc >= 4) { |
|
|
|
|
do_set(argv[2], argv[3]); |
|
|
|
|
if (argc >= 5) { |
|
|
|
|
|
|
|
|
|
/* if the fail switch is provided, fails the command if not found */ |
|
|
|
|
bool fail = !strcmp(argv[4], "fail"); |
|
|
|
|
|
|
|
|
|
do_set(argv[2], argv[3], fail); |
|
|
|
|
|
|
|
|
|
} else if (argc >= 4) { |
|
|
|
|
do_set(argv[2], argv[3], false); |
|
|
|
|
} else { |
|
|
|
|
errx(1, "not enough arguments.\nTry 'param set PARAM_NAME 3'"); |
|
|
|
|
errx(1, "not enough arguments.\nTry 'param set PARAM_NAME 3 [fail]'"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -282,7 +289,7 @@ do_show_print(void *arg, param_t param)
@@ -282,7 +289,7 @@ do_show_print(void *arg, param_t param)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
do_set(const char* name, const char* val) |
|
|
|
|
do_set(const char* name, const char* val, bool fail_on_not_found) |
|
|
|
|
{ |
|
|
|
|
int32_t i; |
|
|
|
|
float f; |
|
|
|
@ -290,8 +297,8 @@ do_set(const char* name, const char* val)
@@ -290,8 +297,8 @@ do_set(const char* name, const char* val)
|
|
|
|
|
|
|
|
|
|
/* set nothing if parameter cannot be found */ |
|
|
|
|
if (param == PARAM_INVALID) { |
|
|
|
|
/* param not found */ |
|
|
|
|
errx(1, "Error: Parameter %s not found.", name); |
|
|
|
|
/* param not found - fail silenty in scripts as it prevents booting */ |
|
|
|
|
errx(((fail_on_not_found) ? 1 : 0), "Error: Parameter %s not found.", name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
printf("%c %s: ", |
|
|
|
|