From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_itest.c: also support environment variables as arguments
Date: Fri, 26 Feb 2010 13:42:46 +0100 [thread overview]
Message-ID: <20100226124246.20D16EBAA8A@gemini.denx.de> (raw)
In-Reply-To: <m2d3zstby2.fsf@ohwell.denx.de>
Dear Detlev Zundel,
In message <m2d3zstby2.fsf@ohwell.denx.de> you wrote:
> Hi Frans,
>
> > Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
> > ---
> > common/cmd_itest.c | 8 ++++++++
> > 1 files changed, 8 insertions(+), 0 deletions(-)
> >
> > diff --git a/common/cmd_itest.c b/common/cmd_itest.c
> > index 58c5e7b..78a4082 100644
> > --- a/common/cmd_itest.c
> > +++ b/common/cmd_itest.c
> > @@ -69,6 +69,10 @@ static long evalexp(char *s, int w)
> > long l = 0;
> > long *p;
> >
> > + /* if the parameter starts with a $ replace it with the environment value */
> > + if (s[0] == '$') {
> > + s = getenv(&s[1]);
> > + }
>
> This is actually a good idea, but I believe this does not work for the
> preferred ${variable} syntax, right?
... not to mention that it's fundamentally broken if the variable in
question is not an environment variable, but aplain hush shell
variable.
If you want variable subsitution, then please let the shell do this.
Don't reinvent the wheel.
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
Remember thee Ay, thou poor ghost while memory holds a seat In this
distracted globe. Remember thee! Yea, from the table of my memory
I'll wipe away all trivial fond records, All saws of books, all
forms, all pressures past, That youth and observation copied there.
Hamlet, I : v : 95 William Shakespeare
prev parent reply other threads:[~2010-02-26 12:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 9:22 [U-Boot] [PATCH] cmd_itest.c: also support environment variables as arguments Frans Meulenbroeks
2010-02-26 12:32 ` Detlev Zundel
2010-02-26 12:42 ` Wolfgang Denk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100226124246.20D16EBAA8A@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.