[RFC PATCH 08/28] cli: lil: Handle commands with dots

Sean Anderson seanga2 at gmail.com
Thu Jul 1 08:15:51 CEST 2021


Some commands (such as md, mw, etc) use dot suffixes as options to the
command. Therefore, we must ignore anything after a dot when finding
commands.

Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---

 common/cli_lil.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/cli_lil.c b/common/cli_lil.c
index 539a4a3238..dd020e8452 100644
--- a/common/cli_lil.c
+++ b/common/cli_lil.c
@@ -579,7 +579,17 @@ static struct lil_var *lil_find_var(struct lil *lil, struct lil_env *env,
 
 static struct lil_func *lil_find_cmd(struct lil *lil, const char *name)
 {
-	return hm_get(&lil->cmdmap, name);
+	struct lil_func *r;
+	char *dot = strchr(name, '.');
+
+	/* Some U-Boot commands have dots in their names */
+	if (dot)
+		*dot = '\0';
+	r = hm_get(&lil->cmdmap, name);
+
+	if (dot)
+		*dot = '.';
+	return r;
 }
 
 static struct lil_func *add_func(struct lil *lil, const char *name)
-- 
2.32.0



More information about the U-Boot mailing list