diff options
author | Grant Erickson <gerickson@nuovations.com> | 2008-05-06 20:16:15 -0700 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-05-09 23:40:40 +0200 |
commit | bc11756daff89a3de09ca80adac962b88cf06e6e (patch) | |
tree | 9688c4851714884484c3e1834f272cb63e7b4cb6 /tools/env/fw_env_main.c | |
parent | f3b6d528e4dd719640a4bfcd954f4e4c7f5db0d6 (diff) | |
download | u-boot-imx-bc11756daff89a3de09ca80adac962b88cf06e6e.zip u-boot-imx-bc11756daff89a3de09ca80adac962b88cf06e6e.tar.gz u-boot-imx-bc11756daff89a3de09ca80adac962b88cf06e6e.tar.bz2 |
Propagate Error Status to the Shell on fw_printenv Errors
Changed implementation such that fw_printenv returns failure status
when one or more specified variables do not exist or when incorrect
command syntax is used.
This aids scripting fw_printenv such that the script can key of the
return status rather than relying on standard error "scraping".
Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'tools/env/fw_env_main.c')
-rw-r--r-- | tools/env/fw_env_main.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c index 696e30e..7f631c4 100644 --- a/tools/env/fw_env_main.c +++ b/tools/env/fw_env_main.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2000 + * (C) Copyright 2000-2008 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this @@ -25,15 +25,16 @@ * Command line user interface to firmware (=U-Boot) environment. * * Implements: - * fw_printenv [ name ... ] - * - prints the values of the environment variables - * "name", or the whole environment if no names are - * specified + * fw_printenv [[ -n name ] | [ name ... ]] + * - prints the value of a single environment variable + * "name", the ``name=value'' pairs of one or more + * environment variables "name", or the whole + * environment if no names are specified. * fw_setenv name [ value ... ] * - If a name without any values is given, the variable * with this name is deleted from the environment; * otherwise, all "value" arguments are concatenated, - * separated by sinlge blank characters, and the + * separated by single blank characters, and the * resulting string is assigned to the environment * variable "name" */ @@ -58,16 +59,18 @@ main(int argc, char *argv[]) if (strcmp(cmdname, CMD_PRINTENV) == 0) { - fw_printenv (argc, argv); + if (fw_printenv (argc, argv) != 0) + return (EXIT_FAILURE); - return (EXIT_SUCCESS); + return (EXIT_SUCCESS); } else if (strcmp(cmdname, CMD_SETENV) == 0) { - if (fw_setenv (argc, argv) != 0) - return (EXIT_FAILURE); + if (fw_setenv (argc, argv) != 0) + return (EXIT_FAILURE); + + return (EXIT_SUCCESS); - return (EXIT_SUCCESS); } fprintf (stderr, |