summaryrefslogtreecommitdiffstats
path: root/common/hush.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:01:46 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:01:46 +0200
commita87f0a7f1899335cb7d62f4dca6a95c5b65af8c1 (patch)
tree3d3db8d5c598f99652bc4252f8e3a1383c997024 /common/hush.c
parent9abd215912609e2b6fd0f60bcd7eaed8d813bfb9 (diff)
downloadbarebox-a87f0a7f1899335cb7d62f4dca6a95c5b65af8c1.tar.gz
barebox-a87f0a7f1899335cb7d62f4dca6a95c5b65af8c1.tar.xz
svn_rev_353
Diffstat (limited to 'common/hush.c')
-rw-r--r--common/hush.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/common/hush.c b/common/hush.c
index 9911655aae..cd4443cc1a 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -94,11 +94,11 @@
#include <linux/ctype.h> /* isalpha, isdigit */
#include <common.h> /* readline */
#include <hush.h>
+#include <environment.h>
#include <command.h> /* find_cmd */
/*cmd_boot.c*/
extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* do_bootd */
#endif
-#ifdef CONFIG_HUSH_PARSER
#ifndef __U_BOOT__
#include <ctype.h> /* isalpha, isdigit */
#include <unistd.h> /* getpid */
@@ -131,7 +131,6 @@ 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
@@ -474,8 +473,9 @@ static int parse_string(o_string *dest, struct p_context *ctx, const char *src);
static int parse_stream(o_string *dest, struct p_context *ctx, struct in_str *input0, int end_trigger);
/* setup: */
static int parse_stream_outer(struct in_str *inp, int flag);
+
+int parse_string_outer(const char *s, int flag);
#ifndef __U_BOOT__
-static int parse_string_outer(const char *s, int flag);
static int parse_file_outer(FILE *f);
#endif
#ifndef __U_BOOT__
@@ -2160,7 +2160,16 @@ static char *get_local_var(const char *s)
if (*s == '$')
return get_dollar_var(s[1]);
#endif
-
+#if 0
+ if (strchr(s, '.')) {
+ char *dev = strdup(s);
+ char *par = strchr(str, '.');
+ *par = 0;
+ par++;
+ do_get_param(dev, par);
+ free(dev);
+ }
+#endif
for (cur = top_vars; cur; cur=cur->next)
if(strcmp(cur->name, s)==0)
return cur->value;
@@ -3177,11 +3186,7 @@ int parse_stream_outer(struct in_str *inp, int flag)
#endif /* __U_BOOT__ */
}
-#ifndef __U_BOOT__
-static int parse_string_outer(const char *s, int flag)
-#else
-int parse_string_outer(char *s, int flag)
-#endif /* __U_BOOT__ */
+int parse_string_outer(const char *s, int flag)
{
struct in_str input;
#ifdef __U_BOOT__
@@ -3524,5 +3529,8 @@ static char * make_string(char ** inp)
return str;
}
-#endif /* CONFIG_HUSH_PARSER */
-/****************************************************************************/
+int run_command (const char *cmd, int flag)
+{
+ return parse_string_outer(cmd, FLAG_PARSE_SEMICOLON);
+}
+