cmd/setexpr: support concatenation of direct strings
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 3 Feb 2025 15:10:29 +0000 (16:10 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 7 Feb 2025 19:35:23 +0000 (13:35 -0600)
commitaf7eca24a78b1419656d618463f1eabe297fdb2f
tree7b12ea285a455fdbd417c1fa1aea062a65fde2f4
parentd4265cdcd57c1975d4e756ab1778c837acc9776c
cmd/setexpr: support concatenation of direct strings

The setexpr.s command allows to concatenate two strings.

According to the description in doc/usage/cmd/setexpr.rst the parameters
value1 and value2 can be either direct values or pointers to a
memory location holding the values.

Unfortunately `setexpr.s <value1> + <value2>` fails if any of the values
is a direct value. $? is set to false.

* Add support for direct values in setexpr.s.
* Correct the unit test for "setexpr.s fred 0".
* Add a new unit test for "setexpr.s fred '1' + '3'" giving '13'.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
cmd/setexpr.c
test/cmd/setexpr.c