cmd: setexpr: add format string handling
Add format string handling operator to the setexpr command.
It allows to use C or Bash like format string expressions to be
evaluated with the result being stored inside the environment variable
name.
setexpr <name> fmt <format> [value]...
The following example
setexpr foo fmt "%d, 0x%x" 0x100 ff
will result in $foo being set to "256, 0xff".
Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/MAINTAINERS b/MAINTAINERS
index 8a18b3b..2a6d01c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1050,6 +1050,11 @@
F: doc/arch/sandbox.rst
F: include/dt-bindings/*/sandbox*.h
+SETEXPR
+M: Roland Gaudig <roland.gaudig@weidmueller.com>
+S: Maintained
+F: cmd/printf.c
+
SH
M: Marek Vasut <marek.vasut+renesas@gmail.com>
M: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>