common: Drop init.h from common header
[oweals/u-boot.git] / cmd / setexpr.c
index e7194fc4f4137a1652250c0de047200aed75469c..0182f1993846cdb4f6d027c6ddf7e6707d7b2d99 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2008 Freescale Semiconductor, Inc.
  * Copyright 2013 Wolfgang Denk <wd@denx.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -12,6 +11,7 @@
 #include <common.h>
 #include <config.h>
 #include <command.h>
+#include <env.h>
 #include <mapmem.h>
 
 static ulong get_arg(char *s, int w)
@@ -145,7 +145,7 @@ static int regex_sub(const char *name,
        }
 
        if (t == NULL) {
-               value = getenv(name);
+               value = env_get(name);
 
                if (value == NULL) {
                        printf("## Error: variable \"%s\" not defined\n", name);
@@ -282,11 +282,11 @@ static int regex_sub(const char *name,
                if (!global)
                        break;
        }
-       debug("## FINAL (now setenv()) :  %s\n", data);
+       debug("## FINAL (now env_set()) :  %s\n", data);
 
        printf("%s=%s\n", name, data);
 
-       return setenv(name, data);
+       return env_set(name, data);
 }
 #endif
 
@@ -314,7 +314,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        /* plain assignment: "setexpr name value" */
        if (argc == 3) {
-               setenv_hex(argv[1], a);
+               env_set_hex(argv[1], a);
                return 0;
        }
 
@@ -370,7 +370,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 1;
        }
 
-       setenv_hex(argv[1], value);
+       env_set_hex(argv[1], value);
 
        return 0;
 }