[U-Boot] [PATCH v2 3/5] tools/env: fw_printenv pass value_only as argument

Andreas Fenkart andreas.fenkart at digitalstrom.com
Tue Apr 19 22:43:41 CEST 2016


Signed-off-by: Andreas Fenkart <andreas.fenkart at digitalstrom.com>
---
 tools/env/fw_env.c      | 6 +++---
 tools/env/fw_env.h      | 4 ++--
 tools/env/fw_env_main.c | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index e5b2e8f..1420855 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 7345922..d4daeea 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 3706d8f..2a45a0d 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) {
-- 
2.8.0.rc3



More information about the U-Boot mailing list