Signed-off-by: Daniel Hobi <[email protected]> --- v2: - print a hint to --help before returning
tools/env/fw_env_main.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) Hi Wolfgang, On 15.09.2010 21:18, Wolfgang Denk wrote: > In message <[email protected]> > you wrote: >> + default: /* '?' */ >> + return EXIT_FAILURE; > > This should print an error message before returning; for example, run > usage() as in the 'h' case - just with different return code. getopt_long(3) already prints a suitable error message (also see [PATCH 1/2]): $ fw_printenv -a fw_printenv: invalid option -- 'a' v2 of this patch additionally prints a hint to the user, in the same way as some Linux core utilities (Debian coreutils: cat, date and 94 others). I prefer this solution to calling usage() which would hide the real error message by printing 20 additional lines. Best regards, Daniel diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c index baf3a4d..c654057 100644 --- a/tools/env/fw_env_main.c +++ b/tools/env/fw_env_main.c @@ -105,6 +105,10 @@ main(int argc, char *argv[]) case 'h': usage(); return EXIT_SUCCESS; + default: /* '?' */ + fprintf(stderr, "Try `%s --help' for more information." + "\n", cmdname); + return EXIT_FAILURE; } } -- 1.7.2.3 _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

