In message <[EMAIL PROTECTED]> you wrote:
> Add -v for verbose output, "Unlocking flash...", "Done" etc.
> Add -q for quiet operation, do not print error and verbose
> messages.
This seems kind of redundandant to me.
And not printing error messages seems an error to me.
> Add a --help(-help, -?) option too.
>
> The -q option is intended for scripting.
Feel free to add "2>/dev/null" to your scripts when you think this is
really what you want to have.
> +int check_option(int *argc, char *argv[], const char *option)
> +{
> + int i,j;
> +
> + for (i = 1; i < *argc; i++)
> + if (strcmp (argv[i], option) == 0) {
> + for (j=i; j < *argc; j++)
> + argv[j] = argv[j+1]; /* remove option */
> + *argc -= 1;
> + return 1;
> + }
> + return 0;
> +}
> +
> +void check_quiet(int *argc, char *argv[])
> +{
> + if (check_option(argc, argv, "-q"))
> + fw_quiet = 1;
> +}
> +
> +void check_verbose(int *argc, char *argv[])
> +{
> + if (check_option(argc, argv, "-v"))
> + fw_verbose = 1;
> +}
I've seen many diffeent versions of argument checking code. This is
not a nice one. See for example "tools/mkimage.c" for the "classic"
approach.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED]
Perl already has an IDE. It's called Unix.
-- Tom Christiansen in [EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
U-Boot-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/u-boot-users