[U-Boot] [PATCH] Handle environment variables like commands
Joakim Tjernlund
joakim.tjernlund at transmode.se
Wed Oct 15 14:09:40 CEST 2008
On Wed, 2008-10-15 at 12:57 +0200, Wolfgang Denk wrote:
> Dear Stefano,
>
> In message <1224065384-24171-1-git-send-email-sbabic at denx.de> you wrote:
> > The command interpreter checks always if an environment variable
> > for that name exists and in this case the content of the variable
> > is executed. It becomes possible to redefine all U-Boot commands.
> > A new "builtin" command is added to be able to run builtin U-boot commands
> > even if they are redefined.
>
> Cool. That's just great.
>
> If I had known it's suffcient to put ideas on a web page to have
> people put them into code I would have started doing this much
> earlier :-)
>
> > + /* Check if exists a variable with that name */
> > + if ((p = getenv (child->argv[i])) != NULL ) {
> > + int rcode;
> > + rcode = (parse_string_outer(p,
> > + FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0);
> > + return rcode;
> > + }
>
> I think this covers only the hush shell version. We need something
> like this instead:
>
>
> #ifdef CFG_HUSH_PARSER
> rcode = parse_string_outer(p, FLAG_PARSE_SEMICOLON |
> FLAG_EXIT_FROM_LOOP);
> #else
> rcode =run_command (p, 0);
> #endif
Move the parse_string_outer() into run_command() instead.
Jocke
More information about the U-Boot
mailing list