tools/env: fw_printenv pass value_only as argument

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
This commit is contained in:
Andreas Fenkart 2016-04-19 22:43:41 +02:00 committed by Tom Rini
parent c3a23e8b5f
commit cedb341e7f
3 changed files with 7 additions and 7 deletions

6
tools/env/fw_env.c vendored
View file

@ -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);
}

4
tools/env/fw_env.h vendored
View file

@ -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);

View file

@ -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) {