On Tuesday 10 January 2012 19:45:52 Simon Glass wrote:
> --- a/arch/sandbox/cpu/os.c
> +++ b/arch/sandbox/cpu/os.c
>
> +static struct option long_options[] = {

constify

> +void os_usage(int err)
> +{
> +     if (err < 0)
> +             fprintf(stderr, "Try `--help' for more information.\n");
> +     fprintf(stderr, "u-boot, "
> +             "a command line test interface to U-Boot\n\n"
> +             "usage:\tu-boot [-ch]\n"
> +             "Options:\n"
> +             "\t-h\tDisplay help\n"
> +             "\t-c <command>\tExecute U-Boot command\n");
> +     exit(1);
> +}

os_usage() should only write to stderr/exit(1) if it's an error, otherwise it 
should use stdout/exit(0)

> +int os_parse_args(struct sandbox_state *state, int argc, char *argv[])
> +{
> ...
> +     while ((c = getopt_long(argc, argv, "c:h",
> +             long_options, NULL)) != EOF) {

pull the optstring ("c:h") out of the getopt_long call and put it into a const 
next to the long_options[] variable

and next to opts array

> +     /* Execute command if required */
> +     if (state->cmd) {
> +             /* TODO: redo this when cmd tidy-up series lands */
> +#ifdef CONFIG_SYS_HUSH_PARSER
> +             run_command(state->cmd, 0);
> +#else
> +             parse_string_outer(state->cmd, FLAG_PARSE_SEMICOLON |
> +                                 FLAG_EXIT_FROM_LOOP);
> +#endif

i'm not sure how useful -c is since we can already do:
          ./u-boot <<<"some command"

each to their own i guess ...
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to