Re: [PATCH 10/10] setexpr: Add support for strings

2020-12-02 Thread Tom Rini
On Sun, Nov 01, 2020 at 02:15:44PM -0700, Simon Glass wrote: > Add support for dealing with string operands, including reading a string > from memory into an environment variable and concatenating two strings. > > Signed-off-by: Simon Glass > Acked-by: Marek BehĂșn Applied to u-boot/next,

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-06 Thread Simon Glass
Hi Tom, On Fri, 6 Nov 2020 at 13:58, Tom Rini wrote: > > On Thu, Nov 05, 2020 at 10:27:25AM -0700, Simon Glass wrote: > > Hi Marek, > > > > On Tue, 3 Nov 2020 at 09:30, Marek Behun wrote: > > > > > > On Tue, 3 Nov 2020 08:12:17 -0700 > > > Simon Glass wrote: > > > > > > > Hi Marek, > > > > > >

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-06 Thread Tom Rini
On Thu, Nov 05, 2020 at 10:27:25AM -0700, Simon Glass wrote: > Hi Marek, > > On Tue, 3 Nov 2020 at 09:30, Marek Behun wrote: > > > > On Tue, 3 Nov 2020 08:12:17 -0700 > > Simon Glass wrote: > > > > > Hi Marek, > > > > > > On Sun, 1 Nov 2020 at 16:08, Marek Behun wrote: > > > > > > > > What is

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-05 Thread Simon Glass
> > setexpr c "*10*100" > > > > > > which is even simpler? > > > > I don't see how that works. The *10 thing in my example reads a string > > out of address 10. > > Ah, got it. This requires your "[PATCH 10/10] setexpr: Add

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-05 Thread Wolfgang Denk
works. The *10 thing in my example reads a string > out of address 10. Ah, got it. This requires your "[PATCH 10/10] setexpr: Add support for strings" first... But then... should there not be some '.s' size specification somewhere? Best regards, Wolfgang Denk -- DENX Software Engine

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-05 Thread Marek Behun
On Thu, 5 Nov 2020 10:27:28 -0700 Simon Glass wrote: > I don't see how that works. The *10 thing in my example reads a string > out of address 10. /o\ ah, OK, that makes sense. So setexpr can dereference strings. I didn't know about that, I thouth the resulting string would be "*10*100".

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-05 Thread Simon Glass
Hi Marek, On Tue, 3 Nov 2020 at 09:30, Marek Behun wrote: > > On Tue, 3 Nov 2020 08:12:17 -0700 > Simon Glass wrote: > > > Hi Marek, > > > > On Sun, 1 Nov 2020 at 16:08, Marek Behun wrote: > > > > > > What is the purpose of + operator on strings? > > > Can't we use setenv "${a}${b}" ? > > > >

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-05 Thread Simon Glass
Hi Wolfgang, On Thu, 5 Nov 2020 at 09:47, Wolfgang Denk wrote: > > Dear Simon, > > In message > you > wrote: > > > > > What is the purpose of + operator on strings? > > > Can't we use setenv "${a}${b}" ? > > > > Yes, that does the same thing, although it is a bit clumsy. > > > > setenv a *10

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-05 Thread Wolfgang Denk
Dear Marek, In message <20201103173011.08e22...@nic.cz> you wrote: > > PS: What I think would be more useful is to add substringing > functionality into hush, so e.g. ${a:3:5}, and pattern substitions: > ${parameter/pattern/string} ... No, NAK, don't. At least not to the current imple,entation

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-05 Thread Wolfgang Denk
Dear Simon, In message you wrote: > > > What is the purpose of + operator on strings? > > Can't we use setenv "${a}${b}" ? > > Yes, that does the same thing, although it is a bit clumsy. > > setenv a *10 > setenv b *100 > setenv c "${a}${b}" > > instead of > > setexpr c *10 + *100 I don't get

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-03 Thread Marek Behun
On Tue, 3 Nov 2020 08:12:17 -0700 Simon Glass wrote: > Hi Marek, > > On Sun, 1 Nov 2020 at 16:08, Marek Behun wrote: > > > > What is the purpose of + operator on strings? > > Can't we use setenv "${a}${b}" ? > > Yes, that does the same thing, although it is a bit clumsy. > > setenv a *10 >

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-03 Thread Simon Glass
Hi Marek, On Sun, 1 Nov 2020 at 16:08, Marek Behun wrote: > > What is the purpose of + operator on strings? > Can't we use setenv "${a}${b}" ? Yes, that does the same thing, although it is a bit clumsy. setenv a *10 setenv b *100 setenv c "${a}${b}" instead of setexpr c *10 + *100 Regards,

Re: [PATCH 10/10] setexpr: Add support for strings

2020-11-01 Thread Marek Behun
What is the purpose of + operator on strings? Can't we use setenv "${a}${b}" ?

[PATCH 10/10] setexpr: Add support for strings

2020-11-01 Thread Simon Glass
Add support for dealing with string operands, including reading a string from memory into an environment variable and concatenating two strings. Signed-off-by: Simon Glass --- cmd/setexpr.c | 82 +++ test/cmd/setexpr.c | 86