search for: eofmark

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

2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...et(next, 0, sizeof(*next)); + next->syntax = syntax; + next->next = *stack; + (*stack)->prev = next; + *stack = next; +} + +static void synstack_pop(struct synstack **stack) +{ + *stack = (*stack)->next; +} + /* @@ -870,24 +897,15 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) size_t len; struct nodelist *bqlist; int quotef; - int dblquote; - int varnest; /* levels of variables expansion */ - int arinest; /* levels of arithmetic expansion */ - int parenlevel; /* levels of parens in arithmetic */ - int dqvarnest; /* levels of variables expansion with...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...et(next, 0, sizeof(*next)); + next->syntax = syntax; + next->next = *stack; + (*stack)->prev = next; + *stack = next; +} + +static void synstack_pop(struct synstack **stack) +{ + *stack = (*stack)->next; +} + /* @@ -870,24 +897,15 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) size_t len; struct nodelist *bqlist; int quotef; - int dblquote; - int varnest; /* levels of variables expansion */ - int arinest; /* levels of arithmetic expansion */ - int parenlevel; /* levels of parens in arithmetic */ - int dqvarnest; /* levels of variables expansion with...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...STATIC void synexpect(int) __attribute__((__noreturn__)); STATIC void synerror(const char *) __attribute__((__noreturn__)); @@ -656,8 +657,10 @@ parseheredoc(void) if (needprompt) { setprompt(2); } - readtoken1(pgetc(), here->here->type == NHERE? SQSYNTAX : DQSYNTAX, - here->eofmark, here->striptabs); + if (here->here->type == NHERE) + readtoken1(pgetc(), SQSYNTAX, here->eofmark, here->striptabs); + else + readtoken1(pgetc_eatbnl(), DQSYNTAX, here->eofmark, here->striptabs); n = (union node *)stalloc(sizeof (struct narg)); n->narg.type = NAR...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...STATIC void synexpect(int) __attribute__((__noreturn__)); STATIC void synerror(const char *) __attribute__((__noreturn__)); @@ -656,8 +657,10 @@ parseheredoc(void) if (needprompt) { setprompt(2); } - readtoken1(pgetc(), here->here->type == NHERE? SQSYNTAX : DQSYNTAX, - here->eofmark, here->striptabs); + if (here->here->type == NHERE) + readtoken1(pgetc(), SQSYNTAX, here->eofmark, here->striptabs); + else + readtoken1(pgetc_eatbnl(), DQSYNTAX, here->eofmark, here->striptabs); n = (union node *)stalloc(sizeof (struct narg)); n->narg.type = NAR...
2019 Jan 25
0
[klibc:update-dash] parser: Fix single-quoted patterns in here-documents
...ecadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index c28363ca..cd980941 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -934,7 +934,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) USTPUTC(c, out); break; case CCTL: - if (eofmark == NULL || synstack->dblquote) + if ((!eofmark) | synstack->dblquote | + synstack->varnest) USTPUTC(CTLESC, out); USTPUTC(c, out); break;
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix single-quoted patterns in here-documents
...ecadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index c28363ca..cd980941 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -934,7 +934,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) USTPUTC(c, out); break; case CCTL: - if (eofmark == NULL || synstack->dblquote) + if ((!eofmark) | synstack->dblquote | + synstack->varnest) USTPUTC(CTLESC, out); USTPUTC(c, out); break;
2012 Oct 01
0
[klibc:master] Avoid overflow for very long variable name
...7984) at memalloc.c:57 #6 0x000000000040ca78 in stalloc (nbytes=18446744071562067972) at memalloc.c:132 #7 0x000000000040ece9 in grabstackblock (len=18446744071562067972) at memalloc.h:67 #8 0x00000000004106b5 in readtoken1 (firstc=118, syntax=0x419522 "", eofmark=0x0, striptabs=0) at parser.c:1040 #9 0x00000000004101a4 in xxreadtoken () at parser.c:826 #10 0x000000000040fe1d in readtoken () at parser.c:697 #11 0x000000000040edcc in parsecmd (interact=0) at parser.c:145 #12 0x000000000040c679 in cmdloop (top=1) at main.c:224 #13 0x000000000040c603...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Add nlprompt/nlnoprompt helpers
...pt = doprompt; + nlnoprompt(); RETURN(TNL); case PEOF: RETURN(TEOF); @@ -837,9 +847,7 @@ static int pgetc_eatbnl(void) break; } - plinno++; - if (doprompt) - setprompt(2); + nlprompt(); } return c; @@ -913,9 +921,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) if (syntax == BASESYNTAX) goto endword; /* exit outer loop */ USTPUTC(c, out); - plinno++; - if (doprompt) - setprompt(2); + nlprompt(); c = pgetc(); goto loop; /* continue outer loop */ case CWORD: @@ -934,9 +940,7 @@ readtoken1(int first...
2019 Jan 25
0
[klibc:update-dash] parser: Fix incorrect eating of backslash newlines
...; } +static int pgetc_top(struct synstack *stack) +{ + return stack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); +} + static void synstack_push(struct synstack **stack, struct synstack *next, const char *syntax) { @@ -915,7 +920,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) attyline(); if (synstack->syntax == BASESYNTAX) return readtoken(); - c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); + c = pgetc_top(synstack); goto loop; } #endif @@ -929,7 +934,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int strip...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Add nlprompt/nlnoprompt helpers
...pt = doprompt; + nlnoprompt(); RETURN(TNL); case PEOF: RETURN(TEOF); @@ -837,9 +847,7 @@ static int pgetc_eatbnl(void) break; } - plinno++; - if (doprompt) - setprompt(2); + nlprompt(); } return c; @@ -913,9 +921,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) if (syntax == BASESYNTAX) goto endword; /* exit outer loop */ USTPUTC(c, out); - plinno++; - if (doprompt) - setprompt(2); + nlprompt(); c = pgetc(); goto loop; /* continue outer loop */ case CWORD: @@ -934,9 +940,7 @@ readtoken1(int first...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix incorrect eating of backslash newlines
...; } +static int pgetc_top(struct synstack *stack) +{ + return stack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); +} + static void synstack_push(struct synstack **stack, struct synstack *next, const char *syntax) { @@ -915,7 +920,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) attyline(); if (synstack->syntax == BASESYNTAX) return readtoken(); - c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); + c = pgetc_top(synstack); goto loop; } #endif @@ -929,7 +934,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int strip...
2019 Jan 25
0
[klibc:update-dash] parser: Allow newlines within parameter substitution
...ecadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index ae76400e..6a8a4a43 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -924,7 +924,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ switch(synstack->syntax[c]) { case CNL: /* '\n' */ - if (synstack->syntax == BASESYNTAX) + if (synstack->syntax == BASESYNTAX && + !synstack->varnest) goto endword; /* e...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Allow newlines within parameter substitution
...ecadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index ae76400e..6a8a4a43 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -924,7 +924,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ switch(synstack->syntax[c]) { case CNL: /* '\n' */ - if (synstack->syntax == BASESYNTAX) + if (synstack->syntax == BASESYNTAX && + !synstack->varnest) goto endword; /* e...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Simplify EOF/newline handling in list parser
...sh/parser.c | 60 ++++++++++++++++++++++++------------------------------- 1 file changed, 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; - tokpu...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Simplify EOF/newline handling in list parser
...sh/parser.c | 60 ++++++++++++++++++++++++------------------------------- 1 file changed, 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; - tokpu...
2010 Mar 22
1
[git pull] dash, sh4, README's
...Fixed execing of scripts with no hash-bang [klibc] [SHELL] Replace shared illnum message by badnum function. [klibc] [EXPAND] Added configure --enable-glob and --enable-fnmatch options [klibc] [PARSER] Fix here-doc corruption [klibc] [PARSER] Removed noexpand/length check on eofmark [klibc] [EXPAND] Removed herefd hack [klibc] [EXPAND] Expand here-documents in the current shell environment [klibc] [PARSER] Add FAKEEOFMARK for expandstr [klibc] [PARSER] Do not show prompts in expandstr [klibc] [EXPAND] Fix slash treatment in expmeta [klibc] [...
2010 Apr 16
0
[git pull v4] dash, sh4, ipconfig, dprintf, fstype, README's
...Fixed execing of scripts with no hash-bang [klibc] [SHELL] Replace shared illnum message by badnum function. [klibc] [EXPAND] Added configure --enable-glob and --enable-fnmatch options [klibc] [PARSER] Fix here-doc corruption [klibc] [PARSER] Removed noexpand/length check on eofmark [klibc] [EXPAND] Removed herefd hack [klibc] [EXPAND] Expand here-documents in the current shell environment [klibc] [PARSER] Add FAKEEOFMARK for expandstr [klibc] [PARSER] Do not show prompts in expandstr [klibc] [EXPAND] Fix slash treatment in expmeta [klibc] [...
2010 Apr 16
0
[PATCH] pull faccessat() system call
...Fixed execing of scripts with no hash-bang [klibc] [SHELL] Replace shared illnum message by badnum function. [klibc] [EXPAND] Added configure --enable-glob and --enable-fnmatch options [klibc] [PARSER] Fix here-doc corruption [klibc] [PARSER] Removed noexpand/length check on eofmark [klibc] [EXPAND] Removed herefd hack [klibc] [EXPAND] Expand here-documents in the current shell environment [klibc] [PARSER] Add FAKEEOFMARK for expandstr [klibc] [PARSER] Do not show prompts in expandstr [klibc] [EXPAND] Fix slash treatment in expmeta [klibc] [...
2010 Mar 28
1
[git pull v3] dash, sh4, ipconfig, dprintf, fstype, README's
...Fixed execing of scripts with no hash-bang [klibc] [SHELL] Replace shared illnum message by badnum function. [klibc] [EXPAND] Added configure --enable-glob and --enable-fnmatch options [klibc] [PARSER] Fix here-doc corruption [klibc] [PARSER] Removed noexpand/length check on eofmark [klibc] [EXPAND] Removed herefd hack [klibc] [EXPAND] Expand here-documents in the current shell environment [klibc] [PARSER] Add FAKEEOFMARK for expandstr [klibc] [PARSER] Do not show prompts in expandstr [klibc] [EXPAND] Fix slash treatment in expmeta [klibc] [...