From: Andreas Fenkart Date: Tue, 19 Apr 2016 20:43:41 +0000 (+0200) Subject: tools/env: fw_printenv pass value_only as argument X-Git-Tag: v2016.07-rc1~165 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cedb341e7f44f4686c8c0afb149a9f7940be110a;p=oweals%2Fu-boot.git tools/env: fw_printenv pass value_only as argument Signed-off-by: Andreas Fenkart --- diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 0c448079cc..aa394858a0 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -239,7 +239,7 @@ int parse_aes_key(char *key, uint8_t *bin_key) * Print the current definition of one, or more, or all * environment variables */ -int fw_printenv (int argc, char *argv[]) +int fw_printenv(int argc, char *argv[], int value_only) { char *env, *nxt; int i, rc = 0; @@ -262,7 +262,7 @@ int fw_printenv (int argc, char *argv[]) return 0; } - if (printenv_args.name_suppress && argc != 1) { + if (value_only && argc != 1) { fprintf(stderr, "## Error: `-n' option requires exactly one argument\n"); return -1; @@ -283,7 +283,7 @@ int fw_printenv (int argc, char *argv[]) } val = envmatch (name, env); if (val) { - if (!printenv_args.name_suppress) { + if (!value_only) { fputs (name, stdout); putc ('=', stdout); } diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h index 7345922911..d4daeeafd9 100644 --- a/tools/env/fw_env.h +++ b/tools/env/fw_env.h @@ -67,7 +67,7 @@ struct common_args { extern struct common_args common_args; struct printenv_args { - int name_suppress; + int value_only; }; extern struct printenv_args printenv_args; @@ -78,7 +78,7 @@ extern struct setenv_args setenv_args; int parse_aes_key(char *key, uint8_t *bin_key); -int fw_printenv(int argc, char *argv[]); +int fw_printenv(int argc, char *argv[], int value_only); char *fw_getenv(char *name); int fw_setenv(int argc, char *argv[]); int fw_parse_script(char *fname); diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c index 3706d8f1a6..2a45a0de28 100644 --- a/tools/env/fw_env_main.c +++ b/tools/env/fw_env_main.c @@ -151,7 +151,7 @@ int parse_printenv_args(int argc, char *argv[]) EOF) { switch (c) { case 'n': - printenv_args.name_suppress = 1; + printenv_args.value_only = 1; break; case 'a': case 'c': @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) } if (do_printenv) { - if (fw_printenv(argc, argv) != 0) + if (fw_printenv(argc, argv, printenv_args.value_only)) retval = EXIT_FAILURE; } else { if (!setenv_args.script_file) {