command: Remove the cmd_tbl_t typedef
[oweals/u-boot.git] / cmd / ini.c
index 727fd1c66407f2f253a59beff3cf1ab6d6c51f7c..c075be623cce04e5938cf7d9e24290f24efb59d2 100644 (file)
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: BSD-3-Clause
 /*
  * inih -- simple .INI file parser
  *
@@ -6,15 +7,13 @@
  *              Joe Hershberger, National Instruments, joe.hershberger@ni.com
  * All rights reserved.
  *
- * SPDX-License-Identifier:    BSD-3-Clause
- *
  * Go to the project home page for more info:
  * http://code.google.com/p/inih/
  */
 
 #include <common.h>
 #include <command.h>
-#include <environment.h>
+#include <env.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
 
@@ -219,7 +218,7 @@ static int ini_handler(void *user, char *section, char *name, char *value)
                for (i = 0; i < strlen(value); i++)
                        value[i] = tolower(value[i]);
 #endif
-               setenv(name, value);
+               env_set(name, value);
                printf("ini: Imported %s as %s\n", name, value);
        }
 
@@ -227,7 +226,7 @@ static int ini_handler(void *user, char *section, char *name, char *value)
        return 1;
 }
 
-static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ini(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        const char *section;
        char *file_address;
@@ -238,9 +237,9 @@ static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        section = argv[1];
        file_address = (char *)simple_strtoul(
-               argc < 3 ? getenv("loadaddr") : argv[2], NULL, 16);
+               argc < 3 ? env_get("loadaddr") : argv[2], NULL, 16);
        file_size = (size_t)simple_strtoul(
-               argc < 4 ? getenv("filesize") : argv[3], NULL, 16);
+               argc < 4 ? env_get("filesize") : argv[3], NULL, 16);
 
        return ini_parse(file_address, file_size, ini_handler, (void *)section);
 }