[U-Boot-Users] [PATCH] Propagate Error Status to the Shell on fw_printenv Errors
Joakim Tjernlund
joakim.tjernlund at transmode.se
Wed May 7 09:29:17 CEST 2008
On Tue, 2008-05-06 at 20:16 -0700, Grant Erickson wrote:
> 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".
>
> Tested On:
> AMCC Kilauea
>
> Tests Run:
> root at kilauea# fw_printenv
> bootdelay=5
> baudrate=115200
> ...
> root at kilauea# echo $?
> 0
>
> root at kilauea# fw_printenv -n hostname
> kilauea
> root at kilauea# echo $?
> 0
>
> root at kilauea# fw_printenv -n hostname ipaddr
> ## Error: `-n' option requires exactly one argument
> root at kilauea# echo $?
> 1
>
> root at kilauea# fw_printenv hostname ipaddr
> hostname=kilauea
> ipaddr=192.168.1.12
> root at kilauea# echo $?
> 0
>
> root at kilauea# fw_printenv foobar
> ## Error: "foobar" not defined
This error message should not be there. It is enough to return exit
status 1. Then one does not have to redirect stderr in scripts
> root at kilauea# echo $?
> 1
>
> root at kilauea# fw_printenv hostname ipaddr foobar
> hostname=kilauea
> ipaddr=192.168.1.12
> ## Error: "foobar" not defined
Same here.
> root at kilauea# echo $?
> 1
>
Could you also remove the messages printed during fw_setenv(show below)?
root at jtd:~# fw_setenv kalle sven
Unlocking flash...
Done
Erasing old environment...
Done
Writing environment to /dev/mtd2...
Done
Locking ...
Done
Perhaps hide them behind a -v(verbose) option?
More information about the U-Boot
mailing list