aboutsummaryrefslogtreecommitdiff
path: root/common/cli_hush_modern.c
diff options
context:
space:
mode:
authorFrancis Laniel2023-12-22 22:02:39 +0100
committerTom Rini2023-12-28 12:02:56 -0500
commit374b77ed9ee573da3f47f4fdaaf69cc82d657c52 (patch)
tree878b705bf3f88154c012219ecb780d8e251b3bc1 /common/cli_hush_modern.c
parentd8b256308d2134ffe8704f26309897ebb9b56b64 (diff)
cli: hush_modern: Enable if keyword
Adds support for "if then else" construct both for command line interface and through run_command(). Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/cli_hush_modern.c')
-rw-r--r--common/cli_hush_modern.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/cli_hush_modern.c b/common/cli_hush_modern.c
index 15bb1f0d924..6360747f210 100644
--- a/common/cli_hush_modern.c
+++ b/common/cli_hush_modern.c
@@ -33,6 +33,7 @@
*/
#define ENABLE_HUSH_INTERACTIVE 1
#define ENABLE_FEATURE_EDITING 1
+#define ENABLE_HUSH_IF 1
/* No MMU in U-Boot */
#define BB_MMU 0
#define USE_FOR_NOMMU(...) __VA_ARGS__
@@ -124,6 +125,11 @@ static void bb_error_msg(const char *s, ...)
va_end(p);
}
+static void bb_simple_error_msg(const char *s)
+{
+ bb_error_msg("%s", s);
+}
+
static void *xmalloc(size_t size)
{
void *p = NULL;
@@ -147,6 +153,11 @@ static void *xrealloc(void *ptr, size_t size)
return p;
}
+static void *xmemdup(const void *s, int n)
+{
+ return memcpy(xmalloc(n), s, n);
+}
+
#define xstrdup strdup
#define xstrndup strndup