cmd: setexpr: add format string handling
authorRoland Gaudig <roland.gaudig@weidmueller.com>
Fri, 23 Jul 2021 12:29:21 +0000 (12:29 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 27 Jul 2021 18:50:47 +0000 (14:50 -0400)
commitf4f8d8bb1abc79c4186ee8dc2ea536d62c6cb149
treeffb09d738a6f68edb543be8eac0f424ec15cd4d3
parent6244cda4f32cb95f66de2a61ef728f325514f8f6
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>
MAINTAINERS
cmd/Kconfig
cmd/Makefile
cmd/printf.c
cmd/printf.h [new file with mode: 0644]
cmd/setexpr.c