search for: tokpushback

Displaying 7 results from an estimated 7 matches for "tokpushback".

2019 Jan 25
0
[klibc:update-dash] [SHELL] Optimize dash -c "command" to avoid a fork
...n.h" +#include "token_vars.h" @@ -86,7 +86,7 @@ struct heredoc *heredoclist; /* list of here documents to read */ int doprompt; /* if set, prompt the user */ int needprompt; /* true if interactive and at start of line */ int lasttoken; /* last token read */ -MKINIT int tokpushback; /* last token pushed back */ +int tokpushback; /* last token pushed back */ char *wordtext; /* text of last word returned by readtoken */ int checkkwd; struct nodelist *backquotelist; @@ -210,6 +210,7 @@ list(int nlflag) parseheredoc(); else pungetc(); /* push back EOF on inp...
2020 Mar 28
0
[klibc:update-dash] dash: [SHELL] Optimize dash -c "command" to avoid a fork
...n.h" +#include "token_vars.h" @@ -86,7 +86,7 @@ struct heredoc *heredoclist; /* list of here documents to read */ int doprompt; /* if set, prompt the user */ int needprompt; /* true if interactive and at start of line */ int lasttoken; /* last token read */ -MKINIT int tokpushback; /* last token pushed back */ +int tokpushback; /* last token pushed back */ char *wordtext; /* text of last word returned by readtoken */ int checkkwd; struct nodelist *backquotelist; @@ -210,6 +210,7 @@ list(int nlflag) parseheredoc(); else pungetc(); /* push back EOF on inp...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Do not push token back before parseheredoc
...commit 2c3ba509eb8117894d515e8fffc94aa099f38f8a ] When we read the first token in list() we use peektoken instead of readtoken as the following code needs to use the same token again. However, this is wrong when we're in a here-document as it will clobber the saved token without resetting the tokpushback flag. This patch fixes it by doing the tokpushback after parseheredoc and setting lasttoken again if parseheredoc was called. Reported-by: Ron Yorston <rmy at frippery.org> Fixes: 7c245aa8ed33 ("[PARSER] Simplify EOF/newline handling in...") Fixes: ee5cbe9fd6bc ("[SHELL] Opti...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Simplify EOF/newline handling in list parser
...anged, 26 insertions(+), 34 deletions(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index f0c919d5..382ddf24 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -135,19 +135,13 @@ static inline int realeofmark(const char *eofmark) union node * parsecmd(int interact) { - int t; - tokpushback = 0; + checkkwd = 0; + heredoclist = 0; doprompt = interact; if (doprompt) setprompt(doprompt); needprompt = 0; - t = readtoken(); - if (t == TEOF) - return NEOF; - if (t == TNL) - return NULL; - tokpushback++; return list(1); } @@ -158,11 +152,27 @@ list(int nlflag) union node *n...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Simplify EOF/newline handling in list parser
...anged, 26 insertions(+), 34 deletions(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index f0c919d5..382ddf24 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -135,19 +135,13 @@ static inline int realeofmark(const char *eofmark) union node * parsecmd(int interact) { - int t; - tokpushback = 0; + checkkwd = 0; + heredoclist = 0; doprompt = interact; if (doprompt) setprompt(doprompt); needprompt = 0; - t = readtoken(); - if (t == TEOF) - return NEOF; - if (t == TNL) - return NULL; - tokpushback++; return list(1); } @@ -158,11 +152,27 @@ list(int nlflag) union node *n...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Save/restore here-documents in command substitution
...{ - /* - * Start reading from old file again, ignoring any pushed back - * tokens left from the backquote parsing - */ - popfile(); + /* Start reading from old file again. */ + popfile(); + /* Ignore any pushed back tokens left from the backquote parsing. */ + if (oldstyle) tokpushback = 0; - } while (stackblocksize() <= savelen) growstackblock(); STARTSTACKSTR(out);
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Add growstackto helper
...e_t, char *); char *stputs(const char *, char *); diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 809c6a8a..3de977c1 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1460,9 +1460,7 @@ done: /* Ignore any pushed back tokens left from the backquote parsing. */ if (oldstyle) tokpushback = 0; - while (stackblocksize() <= savelen) - growstackblock(); - STARTSTACKSTR(out); + out = growstackto(savelen + 1); if (str) { memcpy(out, str, savelen); STADJUST(savelen, out);