All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd_itest.c: also support environment variables as arguments
@ 2010-02-25  9:22 Frans Meulenbroeks
  2010-02-26 12:32 ` Detlev Zundel
  0 siblings, 1 reply; 3+ messages in thread
From: Frans Meulenbroeks @ 2010-02-25  9:22 UTC (permalink / raw)
  To: u-boot

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]);
+	}
 	/* if the parameter starts with a * then assume is a pointer to the value we want */
 	if (s[0] == '*') {
 		p = (long *)simple_strtoul(&s[1], NULL, 16);
@@ -86,6 +90,10 @@ static long evalexp(char *s, int w)
 
 static char * evalstr(char *s)
 {
+	/* if the parameter starts with a $ replace it with the environment value */
+	if (s[0] == '$') {
+		s = getenv(&s[1]);
+	}
 	/* if the parameter starts with a * then assume a string pointer else its a literal */
 	if (s[0] == '*') {
 		return (char *)simple_strtoul(&s[1], NULL, 16);
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-26 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.