search for: expandarg

Displaying 12 results from an estimated 12 matches for "expandarg".

Did you mean: expandargv
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add assignment built-in support again
...esult->nleft, result->jp)); } -static char ** -parse_command_args(char **argv, const char **path) +static struct strlist *fill_arglist(struct arglist *arglist, + union node **argpp) { + struct strlist **lastp = arglist->lastp; + union node *argp; + + while ((argp = *argpp)) { + expandarg(argp, arglist, EXP_FULL | EXP_TILDE); + *argpp = argp->narg.next; + if (*lastp) + break; + } + + return *lastp; +} + +static int parse_command_args(struct arglist *arglist, union node **argpp, + const char **path) +{ + struct strlist *sp = arglist->list; char *cp, c; for (;;...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Use the correct expansion mode for fd redirection
...h/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index dc0c9fa2..4981f156 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -529,7 +529,7 @@ expredir(union node *n) case NFROMFD: case NTOFD: if (redir->ndup.vname) { - expandarg(redir->ndup.vname, &fn, EXP_FULL | EXP_TILDE); + expandarg(redir->ndup.vname, &fn, EXP_TILDE | EXP_REDIR); fixredir(redir, fn.list->text, 1); } break;
2020 Mar 28
0
[klibc:update-dash] dash: eval: avoid leaking memory associated with redirections
...on node *argp; struct strlist *sp; - struct stackmark smark; int status; errlinno = lineno = n->nfor.linno; if (funcline) lineno -= funcline - 1; - setstackmark(&smark); arglist.lastp = &arglist.list; for (argp = n->nfor.args ; argp ; argp = argp->narg.next) { expandarg(argp, &arglist, EXP_FULL | EXP_TILDE); @@ -420,7 +424,6 @@ evalfor(union node *n, int flags) break; } loopnest--; - popstackmark(&smark); return status; } @@ -433,14 +436,12 @@ evalcase(union node *n, int flags) union node *cp; union node *patp; struct arglist arglist; -...
2019 Jan 25
0
[klibc:update-dash] [EVAL] Move common skipcount logic into skiploop
...if (evalskip) - goto skipping; - } + skip = skiploop(); + } while (!(skip & ~SKIPCONT)); loopnest--; exitstatus = status; } @@ -392,9 +409,6 @@ evalfor(union node *n, int flags) arglist.lastp = &arglist.list; for (argp = n->nfor.args ; argp ; argp = argp->narg.next) { expandarg(argp, &arglist, EXP_FULL | EXP_TILDE); - /* XXX */ - if (evalskip) - goto out; } *arglist.lastp = NULL; @@ -404,18 +418,10 @@ evalfor(union node *n, int flags) for (sp = arglist.list ; sp ; sp = sp->next) { setvar(n->nfor.var, sp->text, 0); evaltree(n->nfor.body, f...
2020 Mar 28
0
[klibc:update-dash] dash: [EVAL] Move common skipcount logic into skiploop
...if (evalskip) - goto skipping; - } + skip = skiploop(); + } while (!(skip & ~SKIPCONT)); loopnest--; exitstatus = status; } @@ -392,9 +409,6 @@ evalfor(union node *n, int flags) arglist.lastp = &arglist.list; for (argp = n->nfor.args ; argp ; argp = argp->narg.next) { expandarg(argp, &arglist, EXP_FULL | EXP_TILDE); - /* XXX */ - if (evalskip) - goto out; } *arglist.lastp = NULL; @@ -404,18 +418,10 @@ evalfor(union node *n, int flags) for (sp = arglist.list ; sp ; sp = sp->next) { setvar(n->nfor.var, sp->text, 0); evaltree(n->nfor.body, f...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Do not reprocess data when expanding words
..., int flag); STATIC void expbackq(union node *, int); -STATIC const char *subevalvar(char *, char *, int, int, int, int, int); STATIC char *evalvar(char *, int); static size_t strtodest(const char *p, int flags); static void memtodest(const char *p, size_t len, int flags); @@ -192,13 +192,11 @@ expandarg(union node *arg, struct arglist *arglist, int flag) argbackq = arg->narg.backquote; STARTSTACKSTR(expdest); argstr(arg->narg.text, flag); - p = _STPUTC('\0', expdest); - expdest = p - 1; if (arglist == NULL) { /* here document expanded */ goto out; } - p = grabstackstr...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix old-style command substitution here-document crash
...:288:12 > #6 0x5270da in evaltreenr /home/jfe/dash/src/eval.c:332:2 > #7 0x526f04 in evalbackcmd /home/jfe/dash/src/eval.c:640:3 > #8 0x539020 in expbackq /home/jfe/dash/src/expand.c:522:2 > #9 0x5332d7 in argstr /home/jfe/dash/src/expand.c:343:4 > #10 0x5322f7 in expandarg /home/jfe/dash/src/expand.c:196:2 > #11 0x528118 in fill_arglist /home/jfe/dash/src/eval.c:659:3 > #12 0x5213b6 in evalcommand /home/jfe/dash/src/eval.c:769:13 > #13 0x520010 in evaltree /home/jfe/dash/src/eval.c:288:12 > #14 0x554423 in cmdloop /home/jfe/dash/src/main.c...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Replace with listsetvar with mklocal/setvareq
...(unlikely(status)) { + vlocal = 0; bail: exitstatus = status; @@ -829,13 +839,19 @@ bail: goto out; } + if (likely(vlocal)) + localvar_stop = pushlocalvars(); + for (argp = cmd->ncmd.assign; argp; argp = argp->narg.next) { struct strlist **spp; spp = varlist.lastp; expandarg(argp, &varlist, EXP_VARTILDE); - mklocal((*spp)->text); + if (vlocal) + mklocal((*spp)->text, VEXPORT); + else + setvareq((*spp)->text, vflags); } /* Print the command if xflag is set. */ @@ -857,8 +873,8 @@ bail: /* Now locate the command. */ if (cmdentry.cmdtype !=...
2019 Jan 25
0
[klibc:update-dash] builtin: Fix handling of trailing IFS white spaces
...b/usr/dash/expand.c index c04ff6e1..9079b74b 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -50,6 +50,7 @@ #include <glob.h> #endif #include <ctype.h> +#include <stdbool.h> /* * Routines to expand arguments to commands. We have to deal with @@ -203,7 +204,7 @@ expandarg(union node *arg, struct arglist *arglist, int flag) * TODO - EXP_REDIR */ if (flag & EXP_FULL) { - ifsbreakup(p, &exparg); + ifsbreakup(p, -1, &exparg); *exparg.lastp = NULL; exparg.lastp = &exparg.list; expandmeta(exparg.list, flag); @@ -1016,15 +1017,18 @@ recor...
2020 Mar 28
0
[klibc:update-dash] dash: builtin: Fix handling of trailing IFS white spaces
...b/usr/dash/expand.c index c04ff6e1..9079b74b 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -50,6 +50,7 @@ #include <glob.h> #endif #include <ctype.h> +#include <stdbool.h> /* * Routines to expand arguments to commands. We have to deal with @@ -203,7 +204,7 @@ expandarg(union node *arg, struct arglist *arglist, int flag) * TODO - EXP_REDIR */ if (flag & EXP_FULL) { - ifsbreakup(p, &exparg); + ifsbreakup(p, -1, &exparg); *exparg.lastp = NULL; exparg.lastp = &exparg.list; expandmeta(exparg.list, flag); @@ -1016,15 +1017,18 @@ recor...
2019 Jan 25
0
[klibc:update-dash] eval: Return status in eval functions
...lags) { union node *cp; union node *patp; struct arglist arglist; struct stackmark smark; + int status = 0; errlinno = lineno = n->ncase.linno; if (funcline) @@ -444,12 +442,16 @@ evalcase(union node *n, int flags) setstackmark(&smark); arglist.lastp = &arglist.list; expandarg(n->ncase.expr, &arglist, EXP_TILDE); - exitstatus = 0; for (cp = n->ncase.cases ; cp && evalskip == 0 ; cp = cp->nclist.next) { for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) { if (casematch(patp, arglist.list->text)) { - if (evalskip == 0)...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Return status in eval functions
...lags) { union node *cp; union node *patp; struct arglist arglist; struct stackmark smark; + int status = 0; errlinno = lineno = n->ncase.linno; if (funcline) @@ -444,12 +442,16 @@ evalcase(union node *n, int flags) setstackmark(&smark); arglist.lastp = &arglist.list; expandarg(n->ncase.expr, &arglist, EXP_TILDE); - exitstatus = 0; for (cp = n->ncase.cases ; cp && evalskip == 0 ; cp = cp->nclist.next) { for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) { if (casematch(patp, arglist.list->text)) { - if (evalskip == 0)...