]> Git Repo - J-u-boot.git/blobdiff - cmd/setexpr.c
Subtree merge tag 'v6.12-dts' of dts repo [1] into dts/upstream
[J-u-boot.git] / cmd / setexpr.c
index 4d671e7ef12b17792dcdf9a892a13593d92fa637..e111b8ba98ad7c276621aca949ccd31ba5dc12ed 100644 (file)
@@ -8,7 +8,6 @@
  * This file provides a shell like 'expr' function to return.
  */
 
-#include <common.h>
 #include <config.h>
 #include <command.h>
 #include <ctype.h>
@@ -16,6 +15,8 @@
 #include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
+#include <vsprintf.h>
+#include <linux/errno.h>
 #include <linux/sizes.h>
 #include "printf.h"
 
@@ -215,15 +216,13 @@ int setexpr_regex_sub(char *data, uint data_size, char *nbuf, uint nbuf_size,
 
                if (res == 0) {
                        if (loop == 0) {
-                               printf("%s: No match\n", data);
-                               return 1;
+                               debug("%s: No match\n", data);
                        } else {
-                               break;
+                               debug("## MATCH ## %s\n", data);
                        }
+                       break;
                }
 
-               debug("## MATCH ## %s\n", data);
-
                if (!s)
                        return 1;
 
@@ -359,7 +358,7 @@ static int regex_sub_var(const char *name, const char *r, const char *s,
        if (ret)
                return 1;
 
-       printf("%s=%s\n", name, data);
+       debug("%s=%s\n", name, data);
 
        return env_set(name, data);
 }
@@ -540,7 +539,8 @@ U_BOOT_CMD(
        "    - For each substring matching the regular expression <r> in the\n"
        "      string <t>, substitute the string <s>.  The result is\n"
        "      assigned to <name>.  If <t> is not supplied, use the old\n"
-       "      value of <name>\n"
+       "      value of <name>. If no substring matching <r> is found in <t>,\n"
+       "      assign <t> to <name>.\n"
        "setexpr name sub r s [t]\n"
        "    - Just like gsub(), but replace only the first matching substring"
 #endif
This page took 0.033918 seconds and 4 git commands to generate.