]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/hymod/env.c
Merge branch 'master' of git://git.denx.de/u-boot-nds32
[karo-tx-uboot.git] / board / hymod / env.c
index f9e14213ceb91b4826d3df3ec5ffd2fb6fcb983f..66c5115b217c43d4276da58e10dae647c9b79548 100644 (file)
@@ -2,26 +2,13 @@
  * (C) Copyright 2003
  * Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <linux/ctype.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 /* imports from fetch.c */
 extern int fetch_and_parse (char *, ulong, int (*)(uchar *, uchar *));
@@ -32,10 +19,8 @@ static char *def_global_env_path = "/hymod/global_env";
 static int
 env_callback (uchar *name, uchar *value)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
-       char ov[CFG_CBSIZE], nv[CFG_CBSIZE], *p, *q, *nn, c, *curver, *newver;
+       char ov[CONFIG_SYS_CBSIZE], nv[CONFIG_SYS_CBSIZE], *p, *q, *nn, c, *curver, *newver;
        int override = 1, append = 0, remove = 0, nnl, ovl, nvl;
 
        nn = (char *)name;
@@ -45,7 +30,7 @@ env_callback (uchar *name, uchar *value)
                nn++;
        }
 
-       while (*nn == ' ' || *nn == '\t')
+       while (isblank(*nn))
                nn++;
 
        if ((nnl = strlen (nn)) == 0) {
@@ -61,7 +46,7 @@ env_callback (uchar *name, uchar *value)
                nn[--nnl] = '\0';
        }
 
-       while (nnl > 0 && ((c = nn[nnl - 1]) == ' ' || c == '\t'))
+       while (nnl > 0 && isblank(nn[nnl - 1]))
                nn[--nnl] = '\0';
        if (nnl == 0) {
                printf ("Empty name in global env file\n");
@@ -71,11 +56,11 @@ env_callback (uchar *name, uchar *value)
        p = (char *)value;
        q = nv;
 
-       while ((c = *p) == ' ' || c == '\t')
+       while (isblank(*p))
                p++;
 
        nvl = strlen (p);
-       while (nvl > 0 && ((c = p[nvl - 1]) == ' ' || c == '\t'))
+       while (nvl > 0 && isblank(p[nvl - 1]))
                p[--nvl] = '\0';
 
        while ((*q = *p++) != '\0') {
@@ -205,7 +190,7 @@ hymod_check_env (void)
        if ((path = getenv ("global_env_path")) == NULL || *path == '\0')
                path = def_global_env_path;
 
-       if (fetch_and_parse (path, CFG_LOAD_ADDR, env_callback) == 0) {
+       if (fetch_and_parse (path, CONFIG_SYS_LOAD_ADDR, env_callback) == 0) {
                puts ("*** Fetch of global environment failed!\n");
                return;
        }