search for: expdest

Displaying 20 results from an estimated 20 matches for "expdest".

Did you mean: expdes
2020 Mar 28
0
[klibc:update-dash] dash: expand: Do not reprocess data when expanding words
..., 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(p); + p = grabstackstr(expdest); exparg.lastp = &exparg.list; /* * TODO - EXP_REDIR @@ -232,8 +230,7...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Ensure result is escaped in cvtnum
...-static void memtodest(const char *p, size_t len, int flags) +static size_t memtodest(const char *p, size_t len, int flags) { const char *syntax = flags & EXP_QUOTED ? DQSYNTAX : BASESYNTAX; char *q; + char *s; if (unlikely(!len)) - return; + return 0; q = makestrspace(len * 2, expdest); + s = q; do { int c = (signed char)*p++; @@ -818,6 +820,7 @@ static void memtodest(const char *p, size_t len, int flags) } while (--len); expdest = q; + return q - s; } @@ -875,7 +878,7 @@ varvalue(char *name, int varflags, int flags, int quoted) if (num == 0) return -1;...
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Optimise nulonly away and just use quoted as before
...en; 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: record: if (!easy) goto end; - recordreg...
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Optimise nulonly away and just use quoted as before
...en; 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: record: if (!easy) goto end; - recordreg...
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
...en; 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) goto end; record: - recordregion(startloc,...
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
...en; 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) goto end; record: - recordregion(startloc,...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix double-decrement in argstr
...ings <ben at decadent.org.uk> --- usr/dash/expand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index 20362cef..562a4869 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -285,7 +285,7 @@ start: q = stnputs(p, length, expdest); q[-1] &= end - 1; expdest = q - (flag & EXP_WORD ? end : 0); - newloc = expdest - (char *)stackblock() - end; + newloc = q - (char *)stackblock() - end; if (breakall && !inquotes && newloc > startloc) { recordregion(startloc, newloc, 0); }
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix trailing newlines processing in backquote expanding
...ecadent.org.uk> --- usr/dash/expand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index 562a4869..175f037b 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -525,7 +525,7 @@ read: /* Eat all trailing newlines */ dest = expdest; - for (; dest > (char *)stackblock() && dest[-1] == '\n';) + for (; dest > ((char *)stackblock() + startloc) && dest[-1] == '\n';) STUNPUTC(dest); expdest = dest;
2019 Jan 25
0
[klibc:update-dash] expand: Fix ghost fields with unquoted $@/$*
...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 == VSNORMAL) { record: - if (!easy)...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix ghost fields with unquoted $@/$*
...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 == VSNORMAL) { record: - if (!easy)...
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Propagate EXP_QPAT in subevalvar
...ar *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & EXP_QUOTED ? EXP_QPAT : EXP_CASE) : 0)); + (flag & (EXP_QUOTED | EXP_QPAT) ? + EXP_QPAT : EXP_CASE) : 0)); STPUTC('\0', expdest); argbackq = saveargbackq; startp = stackblock() + startloc;
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Do not split quoted VSLENGTH and VSTRIM
...+ * Remove any recorded regions beyond + * start of variable + */ + removerecordregions(startloc); + goto again; } if (varlen < 0 && uflag) @@ -786,9 +780,9 @@ vsplus: } if (subtype == VSNORMAL) { +record: if (!easy) goto end; -record: recordregion(startloc, expdest - (char *)stackblock(), nulonly); goto end; }
2019 Jan 25
0
[klibc:update-dash] expand: Fixed "$@" expansion when EXP_FULL is false
...rvalue(char *name, int varflags, int flags, int *quotedp) int quotes = (discard ? 0 : (flags & QUOTES_ESC)) | QUOTES_KEEPNUL; ssize_t len = 0; + sep = (flags & EXP_FULL) << CHAR_BIT; syntax = quoted ? DQSYNTAX : BASESYNTAX; switch (*name) { @@ -931,16 +932,14 @@ numvar: expdest = p; break; case '@': - sep = 0; - if (quoted) + if (quoted && sep) goto param; /* fall through */ case '*': - sep = ifsset() ? ifsval()[0] : ' '; - if (!quoted) { + if (quoted) + sep = 0; + sep |= ifsset() ? ifsval()[0] : ' '; param:...
2019 Jan 25
0
[klibc:update-dash] expand: 'nolog' and 'debug' options cause "$-" to wreak havoc
...ent.org.uk> --- usr/dash/expand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index 153f6b7a..e86bd29d 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -927,7 +927,7 @@ numvar: case '-': p = makestrspace(NOPTS, expdest); for (i = NOPTS - 1; i >= 0; i--) { - if (optlist[i]) { + if (optlist[i] && optletters[i]) { USTPUTC(optletters[i], p); len++; }
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Propagate EXP_QPAT in subevalvar
...ar *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & EXP_QUOTED ? EXP_QPAT : EXP_CASE) : 0)); + (flag & (EXP_QUOTED | EXP_QPAT) ? + EXP_QPAT : EXP_CASE) : 0)); STPUTC('\0', expdest); argbackq = saveargbackq; startp = stackblock() + startloc;
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Do not split quoted VSLENGTH and VSTRIM
...+ * Remove any recorded regions beyond + * start of variable + */ + removerecordregions(startloc); + goto again; } if (varlen < 0 && uflag) @@ -786,9 +780,9 @@ vsplus: } if (subtype == VSNORMAL) { +record: if (!easy) goto end; -record: recordregion(startloc, expdest - (char *)stackblock(), nulonly); goto end; }
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fixed "$@" expansion when EXP_FULL is false
...rvalue(char *name, int varflags, int flags, int *quotedp) int quotes = (discard ? 0 : (flags & QUOTES_ESC)) | QUOTES_KEEPNUL; ssize_t len = 0; + sep = (flags & EXP_FULL) << CHAR_BIT; syntax = quoted ? DQSYNTAX : BASESYNTAX; switch (*name) { @@ -931,16 +932,14 @@ numvar: expdest = p; break; case '@': - sep = 0; - if (quoted) + if (quoted && sep) goto param; /* fall through */ case '*': - sep = ifsset() ? ifsval()[0] : ' '; - if (!quoted) { + if (quoted) + sep = 0; + sep |= ifsset() ? ifsval()[0] : ' '; param:...
2020 Mar 28
0
[klibc:update-dash] dash: expand: 'nolog' and 'debug' options cause "$-" to wreak havoc
...ent.org.uk> --- usr/dash/expand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index 153f6b7a..e86bd29d 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -927,7 +927,7 @@ numvar: case '-': p = makestrspace(NOPTS, expdest); for (i = NOPTS - 1; i >= 0; i--) { - if (optlist[i]) { + if (optlist[i] && optletters[i]) { USTPUTC(optletters[i], p); len++; }
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...artloc, int varfla char *(*scan)(char *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & (EXP_QUOTED | EXP_QPAT) ? - EXP_QPAT : EXP_CASE) : 0)); + EXP_CASE : 0)); STPUTC('\0', expdest); argbackq = saveargbackq; startp = stackblock() + startloc; @@ -1646,7 +1635,6 @@ char * _rmescapes(char *str, int flag) { char *p, *q, *r; - unsigned inquotes; int notescaped; int globbing; @@ -1676,24 +1664,23 @@ _rmescapes(char *str, int flag) q = mempcpy(q, str, len); }...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...artloc, int varfla char *(*scan)(char *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & (EXP_QUOTED | EXP_QPAT) ? - EXP_QPAT : EXP_CASE) : 0)); + EXP_CASE : 0)); STPUTC('\0', expdest); argbackq = saveargbackq; startp = stackblock() + startloc; @@ -1646,7 +1635,6 @@ char * _rmescapes(char *str, int flag) { char *p, *q, *r; - unsigned inquotes; int notescaped; int globbing; @@ -1676,24 +1664,23 @@ _rmescapes(char *str, int flag) q = mempcpy(q, str, len); }...