Displaying 20 results from an estimated 27 matches for "ustputc".
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...? 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,7 +934,7 @@ readtoken1(int firstc, cha...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...? 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,7 +934,7 @@ readtoken1(int firstc, cha...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...e();
if (syntax == BASESYNTAX)
return readtoken();
- c = pgetc();
+ c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
goto loop;
}
#endif
@@ -916,7 +910,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
goto endword; /* exit outer loop */
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...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...e();
if (syntax == BASESYNTAX)
return readtoken();
- c = pgetc();
+ c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
goto loop;
}
#endif
@@ -916,7 +910,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
goto endword; /* exit outer loop */
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...
2019 Jan 25
0
[klibc:update-dash] parser: Fix single-quoted patterns in here-documents
...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;
2019 Jan 25
0
[klibc:update-dash] parser: Fix incorrect eating of backslash newlines
...;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 striptabs)
goto endword; /* exit outer loop */
USTPUTC(c, out);
nlprompt();
- c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
+ c = pgetc_top(synstack);
goto loop; /* continue outer loop */
case CWORD:
USTPUTC(c, out);
@@ -1056,7 +1061,7 @@ toggledq:
USTPUTC(c, out);
}
}
- c = syntax == SQSYNTAX ? pgetc() :...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix single-quoted patterns in here-documents
...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 incorrect eating of backslash newlines
...;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 striptabs)
goto endword; /* exit outer loop */
USTPUTC(c, out);
nlprompt();
- c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
+ c = pgetc_top(synstack);
goto loop; /* continue outer loop */
case CWORD:
USTPUTC(c, out);
@@ -1056,7 +1061,7 @@ toggledq:
USTPUTC(c, out);
}
}
- c = syntax == SQSYNTAX ? pgetc() :...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Add nlprompt/nlnoprompt helpers
...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 firstc, char const *syntax, char *eofmark, int striptabs)
USTPUTC('\\', out);
pungetc()...
2019 Jan 25
0
[klibc:update-dash] parser: Allow newlines within parameter substitution
...sertions(+), 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, out);
nlprompt();
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Add nlprompt/nlnoprompt helpers
...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 firstc, char const *syntax, char *eofmark, int striptabs)
USTPUTC('\\', out);
pungetc()...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Allow newlines within parameter substitution
...sertions(+), 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, out);
nlprompt();
2020 Mar 28
0
[klibc:update-dash] dash: expand: Merge syntax/quotes in memtodest with flags
...{
int c = (signed char)*p++;
if (c) {
- if ((quotes & QUOTES_ESC) &&
+ if ((flags & QUOTES_ESC) &&
((syntax[c] == CCTL) ||
- (syntax != BASESYNTAX && syntax[c] == CBACK)))
+ (flags & EXP_QUOTED && syntax[c] == CBACK)))
USTPUTC(CTLESC, q);
- } else if (!(quotes & QUOTES_KEEPNUL))
+ } else if (!(flags & EXP_KEEPNUL))
continue;
USTPUTC(c, q);
} while (--len);
@@ -860,14 +857,10 @@ memtodest(const char *p, size_t len, const char *syntax, int quotes) {
}
-STATIC size_t
-strtodest(p, syntax, quotes)
- c...
2019 Jan 25
0
[klibc:update-dash] [INPUT] Kill pgetc_macro
...r/dash/parser.c
+++ b/usr/dash/parser.c
@@ -775,7 +775,7 @@ xxreadtoken(void)
setprompt(2);
}
for (;;) { /* until token or start of word found */
- c = pgetc_macro();
+ c = pgetc();
switch (c) {
case ' ': case '\t':
case PEOA:
@@ -1009,7 +1009,7 @@ quotemark:
USTPUTC(c, out);
}
}
- c = pgetc_macro();
+ c = pgetc();
}
}
endword:
2019 Jan 25
0
[klibc:update-dash] [PARSER] Catch variable length expansions on non-existant specials
...out);
c = pgetc_eatbnl();
} while (is_digit(c));
- }
- else if (is_special(c)) {
+ } else {
int cc = c;
c = pgetc_eatbnl();
@@ -1251,10 +1250,14 @@ varname:
}
}
+ if (!is_special(cc)) {
+ if (subtype == VSLENGTH)
+ subtype = 0;
+ goto badsub;
+ }
+
USTPUTC(cc, out);
}
- else
- goto badsub;
if (subtype == 0) {
switch (c) {
2019 Jan 25
0
[klibc:update-dash] expand: 'nolog' and 'debug' options cause "$-" to wreak havoc
...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: Fix backquote support in here-document EOF mark
...++
1 file changed, 5 insertions(+)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index cd980941..ae76400e 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1037,6 +1037,11 @@ toggledq:
}
break;
case CBQUOTE: /* '`' */
+ if (checkkwd & CHKEOFMARK) {
+ USTPUTC('`', out);
+ break;
+ }
+
PARSEBACKQOLD();
break;
case CEOF:
2019 Jan 25
0
[klibc:update-dash] parser: Fix parsing of ${}
....efa8060f 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1262,7 +1262,7 @@ varname:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- } else {
+ } else if (c != '}') {
int cc = c;
c = pgetc_eatbnl();
@@ -1290,7 +1290,8 @@ varname:
}
USTPUTC(cc, out);
- }
+ } else
+ goto badsub;
if (subtype == 0) {
int cc = c;
2020 Mar 28
0
[klibc:update-dash] dash: [INPUT] Kill pgetc_macro
...r/dash/parser.c
+++ b/usr/dash/parser.c
@@ -775,7 +775,7 @@ xxreadtoken(void)
setprompt(2);
}
for (;;) { /* until token or start of word found */
- c = pgetc_macro();
+ c = pgetc();
switch (c) {
case ' ': case '\t':
case PEOA:
@@ -1009,7 +1009,7 @@ quotemark:
USTPUTC(c, out);
}
}
- c = pgetc_macro();
+ c = pgetc();
}
}
endword:
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Catch variable length expansions on non-existant specials
...out);
c = pgetc_eatbnl();
} while (is_digit(c));
- }
- else if (is_special(c)) {
+ } else {
int cc = c;
c = pgetc_eatbnl();
@@ -1251,10 +1250,14 @@ varname:
}
}
+ if (!is_special(cc)) {
+ if (subtype == VSLENGTH)
+ subtype = 0;
+ goto badsub;
+ }
+
USTPUTC(cc, out);
}
- else
- goto badsub;
if (subtype == 0) {
switch (c) {