[U-Boot] [PATCH] Handle environment variables like commands

Wolfgang Denk wd at denx.de
Wed Oct 15 12:57:12 CEST 2008


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


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: wd at denx.de
For every complex problem, there is a solution that is simple,  neat,
and wrong.                                               - Mark Twain


More information about the U-Boot mailing list