mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
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>
This commit is contained in:
parent
6244cda4f3
commit
f4f8d8bb1a
6 changed files with 299 additions and 177 deletions
8
cmd/printf.h
Normal file
8
cmd/printf.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
|
||||
#ifndef __PRINTF_H
|
||||
#define __PRINTF_H
|
||||
|
||||
int printf_setexpr(char *str, size_t size, int argc, char *const *argv);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue