search for: checkstrspace

Displaying 5 results from an estimated 5 matches for "checkstrspace".

2019 Jan 25
0
[klibc:update-dash] parser: Allow newlines within parameter substitution
.../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; /* exit outer loop */ USTPUTC(c,...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Allow newlines within parameter substitution
.../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; /* exit outer loop */ USTPUTC(c,...
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Add growstackto helper
...index d8e4413d..9d1de74a 100644 --- a/usr/dash/memalloc.c +++ b/usr/dash/memalloc.c @@ -265,6 +265,14 @@ growstackstr(void) return stackblock() + len; } +char *growstackto(size_t len) +{ + while (stackblocksize() < len) + growstackblock(); + + return stackblock(); +} + /* * Called from CHECKSTRSPACE. */ @@ -273,18 +281,8 @@ char * makestrspace(size_t newlen, char *p) { size_t len = p - stacknxt; - size_t size; - for (;;) { - size_t nleft; - - size = stackblocksize(); - nleft = size - len; - if (nleft >= newlen) - break; - growstackblock(); - } - return stackblock() + len; + r...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...turn readtoken(); c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); goto loop; @@ -904,9 +922,9 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) CHECKEND(); /* set c to PEOF if at end of here document */ for (;;) { /* until end of line or end of word */ CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ - switch(syntax[c]) { + switch(synstack->syntax[c]) { case CNL: /* '\n' */ - if (syntax == BASESYNTAX) + if (synstack->syntax == BASESYNTAX) goto endword; /* exit outer loop */ USTPUTC(c, out); nlprompt(); @@ -916,...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...turn readtoken(); c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); goto loop; @@ -904,9 +922,9 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) CHECKEND(); /* set c to PEOF if at end of here document */ for (;;) { /* until end of line or end of word */ CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ - switch(syntax[c]) { + switch(synstack->syntax[c]) { case CNL: /* '\n' */ - if (syntax == BASESYNTAX) + if (synstack->syntax == BASESYNTAX) goto endword; /* exit outer loop */ USTPUTC(c, out); nlprompt(); @@ -916,...