diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-04 09:21:37 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-04 09:21:37 +0100 |
commit | 13408877f4c0d4b2784d3388dd4481369205e46a (patch) | |
tree | 81bd24a8bac468785989c5b8b82a489befcddc5a /common | |
parent | 908bc8ce45f428658dab5826eb6fa2e5d9151aa1 (diff) | |
parent | 14743045fb31bd1d2d4b7eb2ccd2e956b44b01bd (diff) | |
download | barebox-13408877f4c0d4b2784d3388dd4481369205e46a.tar.gz barebox-13408877f4c0d4b2784d3388dd4481369205e46a.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'common')
-rw-r--r-- | common/hush.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/common/hush.c b/common/hush.c index 1f468f601a..b5e111a019 100644 --- a/common/hush.c +++ b/common/hush.c @@ -335,6 +335,19 @@ static int b_addchr(o_string *o, int ch) return 0; } +static int b_addstr(o_string *o, const char *str) +{ + int ret; + + while (*str) { + ret = b_addchr(o, *str++); + if (ret) + return ret; + } + + return 0; +} + static void b_reset(o_string *o) { o->length = 0; @@ -782,7 +795,8 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi) remove_quotes(globbuf.gl_pathc, globbuf.gl_pathv); - if (!strcmp(globbuf.gl_pathv[0], "getopt")) { + if (!strcmp(globbuf.gl_pathv[0], "getopt") && + IS_ENABLED(CONFIG_HUSH_GETOPT)) { ret = builtin_getopt(ctx, child, globbuf.gl_pathc, globbuf.gl_pathv); } else if (!strcmp(globbuf.gl_pathv[0], "exit")) { ret = builtin_exit(ctx, child, globbuf.gl_pathc, globbuf.gl_pathv); @@ -1406,6 +1420,14 @@ static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *i } b_addchr(dest, SPECIAL_VAR_SYMBOL); break; + case '*': + for (i = 1; i < ctx->global_argc; i++) { + b_addstr(dest, ctx->global_argv[i]); + b_addchr(dest, ' '); + } + + advance = 1; + break; default: b_addchr(dest, '$'); } |