search for: shellparam

Displaying 19 results from an estimated 19 matches for "shellparam".

Did you mean: selfparam
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Do not allow break to break across function calls
...diff --git a/usr/dash/eval.c b/usr/dash/eval.c index ccd5e0c0..204f1e57 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -928,9 +928,11 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags) struct jmploc jmploc; int e; int savefuncline; + int saveloopnest; saveparam = shellparam; savefuncline = funcline; + saveloopnest = loopnest; savehandler = handler; if ((e = setjmp(jmploc.loc))) { goto funcdone; @@ -940,6 +942,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags) shellparam.malloc = 0; func->count++; funcline = func->n.ndefun.linno;...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Do not allow break to break across function calls
...diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 1c76d4c5..e0c21f94 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -928,9 +928,11 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags) struct jmploc jmploc; int e; int savefuncline; + int saveloopnest; saveparam = shellparam; savefuncline = funcline; + saveloopnest = loopnest; savehandler = handler; if ((e = setjmp(jmploc.loc))) { goto funcdone; @@ -940,6 +942,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags) shellparam.malloc = 0; func->count++; funcline = func->n.ndefun.linno;...
2019 Jan 25
0
[klibc:update-dash] eval: Variable assignments on functions are no longer persistent
...2e3e 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -886,7 +886,6 @@ raise: break; case CMDFUNCTION: - poplocalvars(1); if (evalfun(cmdentry.u.func, argc, argv, flags)) goto raise; break; @@ -971,9 +970,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags) shellparam.p = argv + 1; shellparam.optind = 1; shellparam.optoff = -1; - pushlocalvars(); evaltree(func->n.ndefun.body, flags & EV_TESTED); - poplocalvars(0); funcdone: INTOFF; loopnest = saveloopnest;
2020 Mar 28
0
[klibc:update-dash] dash: eval: Variable assignments on functions are no longer persistent
...66e5 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -886,7 +886,6 @@ raise: break; case CMDFUNCTION: - poplocalvars(1); if (evalfun(cmdentry.u.func, argc, argv, flags)) goto raise; break; @@ -971,9 +970,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags) shellparam.p = argv + 1; shellparam.optind = 1; shellparam.optoff = -1; - pushlocalvars(); evaltree(func->n.ndefun.body, flags & EV_TESTED); - poplocalvars(0); funcdone: INTOFF; loopnest = saveloopnest;
2019 Jan 25
0
[klibc:update-dash] expand: Fix ghost fields with unquoted $@/$*
...st glob_t *); @@ -712,7 +712,6 @@ evalvar(char *p, int flag) int c; int startloc; ssize_t varlen; - int easy; int quoted; varflags = *p++; @@ -723,12 +722,11 @@ evalvar(char *p, int flag) quoted = flag & EXP_QUOTED; var = p; - easy = (!quoted || (*var == '@' && shellparam.nparam)); startloc = expdest - (char *)stackblock(); p = strchr(p, '=') + 1; again: - varlen = varvalue(var, varflags, flag, &quoted); + varlen = varvalue(var, varflags, flag, quoted); if (varflags & VSNUL) varlen--; @@ -771,8 +769,11 @@ vsplus: if (subtype == VSNO...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix ghost fields with unquoted $@/$*
...st glob_t *); @@ -712,7 +712,6 @@ evalvar(char *p, int flag) int c; int startloc; ssize_t varlen; - int easy; int quoted; varflags = *p++; @@ -723,12 +722,11 @@ evalvar(char *p, int flag) quoted = flag & EXP_QUOTED; var = p; - easy = (!quoted || (*var == '@' && shellparam.nparam)); startloc = expdest - (char *)stackblock(); p = strchr(p, '=') + 1; again: - varlen = varvalue(var, varflags, flag, &quoted); + varlen = varvalue(var, varflags, flag, quoted); if (varflags & VSNUL) varlen--; @@ -771,8 +769,11 @@ vsplus: if (subtype == VSNO...
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Optimise nulonly away and just use quoted as before
...+722,6 @@ evalvar(char *p, int flag) ssize_t varlen; int easy; int quoted; - int nulonly; varflags = *p++; subtype = varflags & VSTYPE; @@ -733,12 +732,11 @@ evalvar(char *p, int flag) quoted = flag & EXP_QUOTED; var = p; easy = (!quoted || (*var == '@' && shellparam.nparam)); - nulonly = easy; startloc = expdest - (char *)stackblock(); p = strchr(p, '=') + 1; again: - varlen = varvalue(var, varflags, flag, &nulonly); + varlen = varvalue(var, varflags, flag, &quoted); if (varflags & VSNUL) varlen--; @@ -783,7 +781,7 @@ vsplus:...
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Optimise nulonly away and just use quoted as before
...+722,6 @@ evalvar(char *p, int flag) ssize_t varlen; int easy; int quoted; - int nulonly; varflags = *p++; subtype = varflags & VSTYPE; @@ -733,12 +732,11 @@ evalvar(char *p, int flag) quoted = flag & EXP_QUOTED; var = p; easy = (!quoted || (*var == '@' && shellparam.nparam)); - nulonly = easy; startloc = expdest - (char *)stackblock(); p = strchr(p, '=') + 1; again: - varlen = varvalue(var, varflags, flag, &nulonly); + varlen = varvalue(var, varflags, flag, &quoted); if (varflags & VSNUL) varlen--; @@ -783,7 +781,7 @@ vsplus:...
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
...+722,7 @@ evalvar(char *p, int flag) ssize_t varlen; int easy; int quoted; + int nulonly; varflags = *p++; subtype = varflags & VSTYPE; @@ -732,11 +733,12 @@ evalvar(char *p, int flag) quoted = flag & EXP_QUOTED; var = p; easy = (!quoted || (*var == '@' && shellparam.nparam)); + nulonly = easy; startloc = expdest - (char *)stackblock(); p = strchr(p, '=') + 1; again: - varlen = varvalue(var, varflags, flag); + varlen = varvalue(var, varflags, flag, &nulonly); if (varflags & VSNUL) varlen--; @@ -787,7 +789,7 @@ vsplus: if (!easy)...
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
...+722,7 @@ evalvar(char *p, int flag) ssize_t varlen; int easy; int quoted; + int nulonly; varflags = *p++; subtype = varflags & VSTYPE; @@ -732,11 +733,12 @@ evalvar(char *p, int flag) quoted = flag & EXP_QUOTED; var = p; easy = (!quoted || (*var == '@' && shellparam.nparam)); + nulonly = easy; startloc = expdest - (char *)stackblock(); p = strchr(p, '=') + 1; again: - varlen = varvalue(var, varflags, flag); + varlen = varvalue(var, varflags, flag, &nulonly); if (varflags & VSNUL) varlen--; @@ -787,7 +789,7 @@ vsplus: if (!easy)...
2002 Aug 18
1
initramfs scripts + cpio archive stuff
...e a cock up in klibc/ash/expand.c, which is fixed by this: diff -ur klibc/ash/expand.c klibc-0.51/ash/expand.c --- klibc/ash/expand.c Sun Aug 18 01:39:42 2002 +++ klibc-0.51/ash/expand.c Sun Aug 18 23:34:10 2002 @@ -435,7 +435,7 @@ } else if (name == '@' || name == '*') { if (*shellparam.p == NULL) return 0; - } else if (name >= '1' || name <= '9') { + } else if (name >= '1' && name <= '9') { int idx = name - '1'; ap = shellparam.p; do { The initrd I used to test (this contains ARM rather than Thumb executab...
2019 Jan 25
0
[klibc:update-dash] expand: Fixed "$@" expansion when EXP_FULL is false
.../* fall through */ case '*': - sep = ifsset() ? ifsval()[0] : ' '; - if (!quoted) { + if (quoted) + sep = 0; + sep |= ifsset() ? ifsval()[0] : ' '; param: - sep |= (flags & EXP_FULL) << CHAR_BIT; - } sepc = sep; *quotedp = !sepc; if (!(ap = shellparam.p))
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fixed "$@" expansion when EXP_FULL is false
.../* fall through */ case '*': - sep = ifsset() ? ifsval()[0] : ' '; - if (!quoted) { + if (quoted) + sep = 0; + sep |= ifsset() ? ifsval()[0] : ' '; param: - sep |= (flags & EXP_FULL) << CHAR_BIT; - } sepc = sep; *quotedp = !sepc; if (!(ap = shellparam.p))
2020 Mar 28
0
[klibc:update-dash] dash: options: Do not set commandname in procargs
...changed, 1 deletion(-) diff --git a/usr/dash/options.c b/usr/dash/options.c index 6f381e61..a46c23b9 100644 --- a/usr/dash/options.c +++ b/usr/dash/options.c @@ -159,7 +159,6 @@ procargs(int argc, char **argv) setinputfile(*xargv, 0); setarg0: arg0 = *xargv++; - commandname = arg0; } shellparam.p = xargv;
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Return without arguments in a trap should use status outside traps
...++++++++++++++--- usr/dash/eval.h | 1 + usr/dash/main.c | 2 +- usr/dash/trap.c | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 57db825b..db7639a4 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -967,7 +967,7 @@ funcdone: shellparam = saveparam; handler = savehandler; INTON; - evalskip &= ~SKIPFUNC; + evalskip &= ~(SKIPFUNC | SKIPFUNCDEF); return e; } @@ -1047,12 +1047,23 @@ breakcmd(int argc, char **argv) int returncmd(int argc, char **argv) { + int skip; + int status; + /* * If called outside a funct...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Return without arguments in a trap should use status outside traps
...++++++++++++++--- usr/dash/eval.h | 1 + usr/dash/main.c | 2 +- usr/dash/trap.c | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index bb9fc260..3325cb62 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -967,7 +967,7 @@ funcdone: shellparam = saveparam; handler = savehandler; INTON; - evalskip &= ~SKIPFUNC; + evalskip &= ~(SKIPFUNC | SKIPFUNCDEF); return e; } @@ -1047,12 +1047,23 @@ breakcmd(int argc, char **argv) int returncmd(int argc, char **argv) { + int skip; + int status; + /* * If called outside a funct...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix multiple issues with EXP_DISCARD in evalvar
...tring and start recording the pattern @@ -778,9 +779,10 @@ again: p = subevalvar(p, NULL, patloc, startloc, varflags, flag); record: - if (flag & EXP_DISCARD) + if ((flag | discard) & EXP_DISCARD) return p; +really_record: if (quoted) { quoted = *var == '@' && shellparam.nparam; if (!quoted)
2020 Mar 28
0
[klibc:update-dash] dash: expand: Do not reprocess data when expanding words
...} @@ -759,20 +744,14 @@ vsplus: varunset(p, var, 0, 0); if (subtype == VSLENGTH) { + if (flag & EXP_DISCARD) + return p; cvtnum(varlen > 0 ? varlen : 0); goto record; } - if (subtype == VSNORMAL) { -record: - if (quoted) { - quoted = *var == '@' && shellparam.nparam; - if (!quoted) - goto end; - } - recordregion(startloc, expdest - (char *)stackblock(), quoted); - goto end; - } + if (subtype == VSNORMAL) + goto record; #ifdef DEBUG switch (subtype) { @@ -786,45 +765,28 @@ record: } #endif - if (varlen >= 0) { + flag |= varlen <...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Merge syntax/quotes in memtodest with flags
..._ESC)) | QUOTES_KEEPNUL; ssize_t len = 0; char c; + flags |= EXP_KEEPNUL; + flags &= discard ? ~QUOTES_ESC : ~0; sep = (flags & EXP_FULL) << CHAR_BIT; - syntax = quoted ? DQSYNTAX : BASESYNTAX; switch (*name) { case '$': @@ -950,11 +942,11 @@ param: if (!(ap = shellparam.p)) return -1; while ((p = *ap++)) { - len += strtodest(p, syntax, quotes); + len += strtodest(p, flags); if (*ap && sep) { len++; - memtodest(&sepc, 1, syntax, quotes); + memtodest(&sepc, 1, flags); } } break; @@ -979,7 +971,7 @@ value: if (...