search for: ctlesc

Displaying 15 results from an estimated 15 matches for "ctlesc".

Did you mean: ctest
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...------------------ 3 files changed, 120 insertions(+), 85 deletions(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index e86bd29d..2c29ea44 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -85,7 +85,7 @@ #define RMESCAPE_HEAP 0x10 /* Malloc strings instead of stalloc */ /* Add CTLESC when necessary. */ -#define QUOTES_ESC (EXP_FULL | EXP_CASE | EXP_QPAT) +#define QUOTES_ESC (EXP_FULL | EXP_CASE) /* Do not skip NUL characters. */ #define QUOTES_KEEPNUL EXP_TILDE @@ -335,16 +335,6 @@ addquote: case CTLESC: startloc++; length++; - - /* - * Quoted parameter expa...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...------------------ 3 files changed, 120 insertions(+), 85 deletions(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index e86bd29d..2c29ea44 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -85,7 +85,7 @@ #define RMESCAPE_HEAP 0x10 /* Malloc strings instead of stalloc */ /* Add CTLESC when necessary. */ -#define QUOTES_ESC (EXP_FULL | EXP_CASE | EXP_QPAT) +#define QUOTES_ESC (EXP_FULL | EXP_CASE) /* Do not skip NUL characters. */ #define QUOTES_KEEPNUL EXP_TILDE @@ -335,16 +335,6 @@ addquote: case CTLESC: startloc++; length++; - - /* - * Quoted parameter expa...
2019 Jan 25
0
[klibc:update-dash] builtin: Fix handling of trailing IFS white spaces
..., *realifs; int ifsspc; int nulonly; @@ -1042,16 +1046,76 @@ ifsbreakup(char *string, struct arglist *arglist) ifs = nulonly ? nullstr : realifs; ifsspc = 0; while (p < string + ifsp->endoff) { + int c; + bool isifs; + bool isdefifs; + q = p; - if (*p == (char)CTLESC) - p++; - if (strchr(ifs, *p)) { + c = *p++; + if (c == (char)CTLESC) + c = *p++; + + isifs = strchr(ifs, c); + isdefifs = false; + if (isifs) + isdefifs = strchr(defifs, c); + + /* If only reading one more argument: + * If we have exactly one field, + * rea...
2020 Mar 28
0
[klibc:update-dash] dash: builtin: Fix handling of trailing IFS white spaces
..., *realifs; int ifsspc; int nulonly; @@ -1042,16 +1046,76 @@ ifsbreakup(char *string, struct arglist *arglist) ifs = nulonly ? nullstr : realifs; ifsspc = 0; while (p < string + ifsp->endoff) { + int c; + bool isifs; + bool isdefifs; + q = p; - if (*p == (char)CTLESC) - p++; - if (strchr(ifs, *p)) { + c = *p++; + if (c == (char)CTLESC) + c = *p++; + + isifs = strchr(ifs, c); + isdefifs = false; + if (isifs) + isdefifs = strchr(defifs, c); + + /* If only reading one more argument: + * If we have exactly one field, + * rea...
2019 Jan 25
0
[klibc:update-dash] parser: Fix single-quoted patterns in here-documents
...mitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] parser: Fix single-quoted patterns in here-documents The script x=* cat <<- EOF ${x#'*'} EOF prints * instead of nothing as it should. The problem is that when we're in sqsyntax context in a here-document, we won't add CTLESC as we should. This patch fixes it: Reported-by: Harald van Dijk <harald at gigawatt.nl> Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix single-quoted patterns in here-documents
...Fix single-quoted patterns in here-documents [ dash commit 9ee3343965950bad08e97f43c8c376b89a50b099 ] The script x=* cat <<- EOF ${x#'*'} EOF prints * instead of nothing as it should. The problem is that when we're in sqsyntax context in a here-document, we won't add CTLESC as we should. This patch fixes it: Reported-by: Harald van Dijk <harald at gigawatt.nl> Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Merge syntax/quotes in memtodest with flags
...dash/expand.c | 42 +++++++++++++++++------------------------- usr/dash/expand.h | 1 + 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index f1f5a9fa..a764881e 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -86,8 +86,6 @@ /* Add CTLESC when necessary. */ #define QUOTES_ESC (EXP_FULL | EXP_CASE) -/* Do not skip NUL characters. */ -#define QUOTES_KEEPNUL EXP_TILDE /* * Structure specifying which parts of the string should be searched @@ -117,8 +115,8 @@ STATIC char *exptilde(char *, char *, int); STATIC void expbackq(union n...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Do not reprocess data when expanding words
...st; /* * TODO - EXP_REDIR @@ -232,8 +230,7 @@ out: * $@ like $* since no splitting will be performed. */ -STATIC void -argstr(char *p, int flag) +static char *argstr(char *p, int flag) { static const char spclchars[] = { '=', @@ -243,6 +240,7 @@ argstr(char *p, int flag) CTLESC, CTLVAR, CTLBACKQ, + CTLARI, CTLENDARI, 0 }; @@ -253,35 +251,41 @@ argstr(char *p, int flag) size_t length; int startloc; - if (!(flag & EXP_VARTILDE)) { - reject += 2; - } else if (flag & EXP_VARTILDE2) { - reject++; - } + reject += !!(flag & EXP_VARTILDE2); + re...
2011 Jun 14
0
klibc 1.5.23 release
...[klibc] [EXPAND] Fix ifsfirst/ifslastp leak in casematch [klibc] [EVAL] Fixed trap/return regression due to SKIPEVAL removal [klibc] [ERROR] Allow the originator of EXERROR to set the exit status [klibc] [EXPAND] Free IFS state in evalbackcmd [klibc] [BUILTIN] Fix CTLESC clobbering by read(1) [klibc] [BUILTIN] Fix backslash handling in read(1) [klibc] [PARSER] Fix clobbering of checkkwd Jilles Tjoelker (5): [klibc] [EVAL] Force fork if any trap is set, not just on EXIT [klibc] [EXPAND] Fix corruption of redirections with byte 0x81 [kl...
2019 Jan 25
0
[klibc:update-dash] expand: Do not quote backslashes in unquoted parameter expansion
...st char *syntax, int quotes) { if (c) { if ((quotes & QUOTES_ESC) && ((syntax[c] == CCTL) || - (((quotes & EXP_FULL) || syntax != BASESYNTAX) && - syntax[c] == CBACK))) + (syntax != BASESYNTAX && syntax[c] == CBACK))) USTPUTC(CTLESC, q); } else if (!(quotes & QUOTES_KEEPNUL)) continue; @@ -1341,7 +1340,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) } } } else { - if (*p == '\\') + if (*p == '\\' && p[1]) esc++; if (p[esc] == '/') { if (m...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Do not quote backslashes in unquoted parameter expansion
...st char *syntax, int quotes) { if (c) { if ((quotes & QUOTES_ESC) && ((syntax[c] == CCTL) || - (((quotes & EXP_FULL) || syntax != BASESYNTAX) && - syntax[c] == CBACK))) + (syntax != BASESYNTAX && syntax[c] == CBACK))) USTPUTC(CTLESC, q); } else if (!(quotes & QUOTES_KEEPNUL)) continue; @@ -1341,7 +1340,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) } } } else { - if (*p == '\\') + if (*p == '\\' && p[1]) esc++; if (p[esc] == '/') { if (m...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...USTPUTC(c, out); nlprompt(); - c = pgetc(); + c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); goto loop; /* continue outer loop */ case CWORD: USTPUTC(c, out); @@ -933,8 +927,6 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) USTPUTC(CTLESC, out); USTPUTC('\\', out); pungetc(); - } else if (c == '\n') { - nlprompt(); } else { if ( dblquote && @@ -997,7 +989,7 @@ quotemark: USTPUTC(c, out); --parenlevel; } else { - if (pgetc() == ')') { + if (...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...USTPUTC(c, out); nlprompt(); - c = pgetc(); + c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); goto loop; /* continue outer loop */ case CWORD: USTPUTC(c, out); @@ -933,8 +927,6 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) USTPUTC(CTLESC, out); USTPUTC('\\', out); pungetc(); - } else if (c == '\n') { - nlprompt(); } else { if ( dblquote && @@ -997,7 +989,7 @@ quotemark: USTPUTC(c, out); --parenlevel; } else { - if (pgetc() == ')') { + if (...
2019 Jan 25
0
[klibc:update-dash] [SHELL] Optimize dash -c "command" to avoid a fork
...r.h index e6caed63..2875cce6 100644 --- a/usr/dash/parser.h +++ b/usr/dash/parser.h @@ -34,6 +34,8 @@ * @(#)parser.h 8.3 (Berkeley) 5/4/95 */ +#include "token.h" + /* control characters in argument strings */ #define CTL_FIRST -127 /* first 'special' character */ #define CTLESC -127 /* escape next character */ @@ -73,6 +75,7 @@ * must be distinct from NULL, so we use the address of a variable that * happens to be handy. */ +extern int lasttoken; extern int tokpushback; #define NEOF ((union node *)&tokpushback) extern int whichprompt; /* 1 == PS1, 2 == PS2 *...
2020 Mar 28
0
[klibc:update-dash] dash: [SHELL] Optimize dash -c "command" to avoid a fork
...r.h index e6caed63..2875cce6 100644 --- a/usr/dash/parser.h +++ b/usr/dash/parser.h @@ -34,6 +34,8 @@ * @(#)parser.h 8.3 (Berkeley) 5/4/95 */ +#include "token.h" + /* control characters in argument strings */ #define CTL_FIRST -127 /* first 'special' character */ #define CTLESC -127 /* escape next character */ @@ -73,6 +75,7 @@ * must be distinct from NULL, so we use the address of a variable that * happens to be handy. */ +extern int lasttoken; extern int tokpushback; #define NEOF ((union node *)&tokpushback) extern int whichprompt; /* 1 == PS1, 2 == PS2 *...