]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/hush.c
MVBC_P: fix compile problem
[karo-tx-uboot.git] / common / hush.c
index eb7f7f15606ab652d43e2012db487fae0292962c..75c18ce8ae0b58d9273916842ecc78caa9f1e5ac 100644 (file)
@@ -1,4 +1,3 @@
-/* vi: set sw=4 ts=4: */
 /*
  * sh.c -- a prototype Bourne shell grammar parser
  *      Intended to follow the original Thompson and Ritchie
@@ -138,6 +137,8 @@ extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);      /
 #endif
 
 #ifdef __U_BOOT__
+DECLARE_GLOBAL_DATA_PTR;
+
 #define EXIT_SUCCESS 0
 #define EOF -1
 #define syntax() syntax_err()
@@ -296,7 +297,7 @@ extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */
 #endif
 
 /* "globals" within this file */
-static char *ifs;
+static uchar *ifs;
 static char map[256];
 #ifndef __U_BOOT__
 static int fake_mode;
@@ -952,7 +953,7 @@ static int b_adduint(o_string *o, unsigned int i)
 
 static int static_get(struct in_str *i)
 {
-       int ch=*i->p++;
+       int ch = *i->p++;
        if (ch=='\0') return EOF;
        return ch;
 }
@@ -1103,7 +1104,7 @@ static int file_get(struct in_str *i)
        ch = 0;
        /* If there is data waiting, eat it up */
        if (i->p && *i->p) {
-               ch=*i->p++;
+               ch = *i->p++;
        } else {
                /* need to double check i->file because we might be doing something
                 * more complicated by now, like sourcing or substituting. */
@@ -1120,7 +1121,7 @@ static int file_get(struct in_str *i)
                        i->__promptme = 0;
 #endif
                        if (i->p && *i->p) {
-                               ch=*i->p++;
+                               ch = *i->p++;
                        }
 #ifndef __U_BOOT__
                } else {
@@ -1680,7 +1681,7 @@ static int run_pipe_real(struct pipe *pi)
                                return -1;      /* give up after bad command */
                        } else {
                                int rcode;
-#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
+#if defined(CONFIG_CMD_BOOTD)
            extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
                                /* avoid "bootd" recursion */
@@ -1692,7 +1693,7 @@ static int run_pipe_real(struct pipe *pi)
                                else
                                        flag |= CMD_FLAG_BOOTD;
                                }
-#endif /* CFG_CMD_BOOTD */
+#endif
                                /* found - check max args */
                                if ((child->argc - i) > cmdtp->maxargs) {
                                        printf ("Usage:\n%s\n", cmdtp->usage);
@@ -2389,6 +2390,7 @@ struct pipe *new_pipe(void) {
        pi->progs = NULL;
        pi->next = NULL;
        pi->followup = 0;  /* invalid */
+       pi->r_mode = RES_NONE;
        return pi;
 }
 
@@ -3133,8 +3135,8 @@ void mapset(const unsigned char *set, int code)
 void update_ifs_map(void)
 {
        /* char *ifs and char map[256] are both globals. */
-       ifs = getenv("IFS");
-       if (ifs == NULL) ifs=" \t\n";
+       ifs = (uchar *)getenv("IFS");
+       if (ifs == NULL) ifs=(uchar *)" \t\n";
        /* Precompute a list of 'flow through' behavior so it can be treated
         * quickly up front.  Computation is necessary because of IFS.
         * Special case handling of IFS == " \t\n" is not implemented.
@@ -3143,11 +3145,11 @@ void update_ifs_map(void)
         */
        memset(map,0,sizeof(map)); /* most characters flow through always */
 #ifndef __U_BOOT__
-       mapset("\\$'\"`", 3);      /* never flow through */
-       mapset("<>;&|(){}#", 1);   /* flow through if quoted */
+       mapset((uchar *)"\\$'\"`", 3);      /* never flow through */
+       mapset((uchar *)"<>;&|(){}#", 1);   /* flow through if quoted */
 #else
-       mapset("\\$'\"", 3);       /* never flow through */
-       mapset(";&|#", 1);         /* flow through if quoted */
+       mapset((uchar *)"\\$'\"", 3);       /* never flow through */
+       mapset((uchar *)";&|#", 1);         /* flow through if quoted */
 #endif
        mapset(ifs, 2);            /* also flow through if quoted */
 }
@@ -3167,7 +3169,7 @@ int parse_stream_outer(struct in_str *inp, int flag)
                ctx.type = flag;
                initialize_context(&ctx);
                update_ifs_map();
-               if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset(";$&|", 0);
+               if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset((uchar *)";$&|", 0);
                inp->promptmode=1;
                rcode = parse_stream(&temp, &ctx, inp, '\n');
 #ifdef __U_BOOT__
@@ -3271,7 +3273,6 @@ int parse_file_outer(void)
 #ifdef __U_BOOT__
 static void u_boot_hush_reloc(void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        unsigned long addr;
        struct reserved_combo *r;