+// SPDX-License-Identifier: GPL-2.0+
/*
* sh.c -- a prototype Bourne shell grammar parser
* Intended to follow the original Thompson and Ritchie
* document how quoting rules not precisely followed for variable assignments
* maybe change map[] to use 2-bit entries
* (eventually) remove all the printf's
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#define __U_BOOT__
#ifdef __U_BOOT__
+#include <common.h> /* readline */
+#include <env.h>
#include <malloc.h> /* malloc, free, realloc*/
#include <linux/ctype.h> /* isalpha, isdigit */
-#include <common.h> /* readline */
#include <console.h>
#include <bootretry.h>
#include <cli.h>
#include <cli_hush.h>
#include <command.h> /* find_cmd */
-#ifndef CONFIG_SYS_PROMPT_HUSH_PS2
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
-#endif
+#include <asm/global_data.h>
#endif
#ifndef __U_BOOT__
#include <ctype.h> /* isalpha, isdigit */
return -1;
}
/* Process the command */
- return cmd_process(flag, child->argc, child->argv,
+ return cmd_process(flag, child->argc - i, child->argv + i,
&flag_repeat, NULL);
#endif
}
continue;
} else {
/* insert new value from list for variable */
- if (pi->progs->argv[0])
- free(pi->progs->argv[0]);
+ free(pi->progs->argv[0]);
pi->progs->argv[0] = *list++;
#ifndef __U_BOOT__
pi->progs->glob_result.gl_pathv[0] =
name=strdup(s);
-#ifdef __U_BOOT__
- if (env_get(name) != NULL) {
- printf ("ERROR: "
- "There is a global environment variable with the same name.\n");
- free(name);
- return -1;
- }
-#endif
/* Assume when we enter this function that we are already in
* NAME=VALUE format. So the first order of business is to
* split 's' on the '=' into 'name' and 'value' */
void *p = NULL;
if (!(p = malloc(size))) {
- printf("ERROR : memory not allocated\n");
+ printf("ERROR : xmalloc failed\n");
for(;;);
}
return p;
void *p = NULL;
if (!(p = realloc(ptr, size))) {
- printf("ERROR : memory not allocated\n");
+ printf("ERROR : xrealloc failed\n");
for(;;);
}
return p;
}
#ifdef __U_BOOT__
-static int do_showvar(cmd_tbl_t *cmdtp, int flag, int argc,
- char * const argv[])
+static int do_showvar(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
int i, k;
int rcode = 0;