aboutsummaryrefslogtreecommitdiff
path: root/cmd/printf.c
AgeCommit message (Collapse)Author
2024-05-06cmd: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from all "cmd/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-08-23cmd: setexpr: fix printf_str()Heinrich Schuchardt
If vsnprintf() returns a negative number, (i >= remaining) will possibly be true: 'i' is of type signed int and 'remaining' is of the unsigned type size_t. The C language will convert i to an unsigned type before the comparison. This can result in the wrong error type being indicated. Checking for negative i should be done first. Fixes: f4f8d8bb1abc ("cmd: setexpr: add format string handling") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-27cmd: setexpr: add format string handlingRoland Gaudig
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>
2021-07-27cmd: printf: add helper functions from busyboxRoland Gaudig
Import the following helper functions from Busybox-1.33.1 which are required by printf.c: process_escape_sequence from libbb/process_escape_sequence.c, skip_whitespace from libbb/skip_whitespace.c, overlapping_strcpy from libbb/safe_strncpy.c src-url: https://git.busybox.net/busybox/ commit bcc5b0e6caca6c7602a6a41f "Bump version to 1.33.1" version: 1.33.1 Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
2021-07-27cmd: printf: import busybox-1.33.1 printf.cRoland Gaudig
Import printf.c from the Busybox project, which provides Bash like format string handling. src-url: https://git.busybox.net/busybox/ commit bcc5b0e6caca6c7602a6a41f "Bump version to 1.33.1" version: 1.33.1 Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>