search for: setprompt

Displaying 13 results from an estimated 13 matches for "setprompt".

2019 Jan 25
0
[klibc:update-dash] [PARSER] Add nlprompt/nlnoprompt helpers
...--------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 2b07437e..f6c43be0 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -743,6 +743,19 @@ out: return (t); } +static void nlprompt(void) +{ + plinno++; + if (doprompt) + setprompt(2); +} + +static void nlnoprompt(void) +{ + plinno++; + needprompt = doprompt; +} + /* * Read the next input token. @@ -786,16 +799,13 @@ xxreadtoken(void) continue; case '\\': if (pgetc() == '\n') { - plinno++; - if (doprompt) - setprompt(2); + nlprompt...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Add nlprompt/nlnoprompt helpers
...--------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 2b07437e..f6c43be0 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -743,6 +743,19 @@ out: return (t); } +static void nlprompt(void) +{ + plinno++; + if (doprompt) + setprompt(2); +} + +static void nlnoprompt(void) +{ + plinno++; + needprompt = doprompt; +} + /* * Read the next input token. @@ -786,16 +799,13 @@ xxreadtoken(void) continue; case '\\': if (pgetc() == '\n') { - plinno++; - if (doprompt) - setprompt(2); + nlprompt...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...C int xxreadtoken(void); +STATIC int pgetc_eatbnl(); STATIC int readtoken1(int, char const *, char *, int); 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-&g...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...C int xxreadtoken(void); +STATIC int pgetc_eatbnl(); STATIC int readtoken1(int, char const *, char *, int); 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-&g...
2019 Jan 25
0
[klibc:update-dash] [INPUT] Kill pgetc_macro
...oid); void closescript(void); - -#define pgetc_macro() \ - (--parsenleft >= 0 ? (signed char)*parsenextc++ : preadbuffer()) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 572cbcd5..c4eaae2b 100644 --- a/usr/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] input: Fix here-document redirection with vi/emacs on
...re-document contents got lost, so there is no command output to see. Nice find. The problem is that getprompt() is implicitly called by el_gets(). This messes with the memory used by the parser to store the here-document's contents. In the non-emacs/vi case, the prompt is explicitly written by setprompt(), which wraps the getprompt() call in a pushstackmark()/popstackmark() pair to restore the state so that parsing can continue. But when getprompt() is called by el_gets(), it knows nothing about this. The whole call to el_gets() can be surrounded by another pushstackmark()/popstackmark() pair to...
2020 Mar 28
0
[klibc:update-dash] dash: [INPUT] Kill pgetc_macro
...oid); void closescript(void); - -#define pgetc_macro() \ - (--parsenleft >= 0 ? (signed char)*parsenextc++ : preadbuffer()) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 572cbcd5..c4eaae2b 100644 --- a/usr/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: input: Fix here-document redirection with vi/emacs on
...re-document contents got lost, so there is no command output to see. Nice find. The problem is that getprompt() is implicitly called by el_gets(). This messes with the memory used by the parser to store the here-document's contents. In the non-emacs/vi case, the prompt is explicitly written by setprompt(), which wraps the getprompt() call in a pushstackmark()/popstackmark() pair to restore the state so that parsing can continue. But when getprompt() is called by el_gets(), it knows nothing about this. The whole call to el_gets() can be surrounded by another pushstackmark()/popstackmark() pair to...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Simplify EOF/newline handling in list parser
...ndex 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 *n1, *n2, *n3; int tok; - checkkwd = CHKNL | CHKKWD | CHKALIAS; - if (nlflag == 2 &&am...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Simplify EOF/newline handling in list parser
...ndex 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 *n1, *n2, *n3; int tok; - checkkwd = CHKNL | CHKKWD | CHKALIAS; - if (nlflag == 2 &&am...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Handle backslash newlines properly after dollar sign
...437e 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -827,6 +827,24 @@ breakloop: #undef RETURN } +static int pgetc_eatbnl(void) +{ + int c; + + while ((c = pgetc()) == '\\') { + if (pgetc() != '\n') { + pungetc(); + break; + } + + plinno++; + if (doprompt) + setprompt(2); + } + + return c; +} + /* @@ -1179,7 +1197,7 @@ parsesub: { char *p; static const char types[] = "}-+?="; - c = pgetc(); + c = pgetc_eatbnl(); if ( (checkkwd & CHKEOFMARK) || c <= PEOA || @@ -1188,7 +1206,7 @@ parsesub: { USTPUTC('$', out); pun...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Handle backslash newlines properly after dollar sign
...437e 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -827,6 +827,24 @@ breakloop: #undef RETURN } +static int pgetc_eatbnl(void) +{ + int c; + + while ((c = pgetc()) == '\\') { + if (pgetc() != '\n') { + pungetc(); + break; + } + + plinno++; + if (doprompt) + setprompt(2); + } + + return c; +} + /* @@ -1179,7 +1197,7 @@ parsesub: { char *p; static const char types[] = "}-+?="; - c = pgetc(); + c = pgetc_eatbnl(); if ( (checkkwd & CHKEOFMARK) || c <= PEOA || @@ -1188,7 +1206,7 @@ parsesub: { USTPUTC('$', out); pun...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add assignment built-in support again
...ctions only */ extern const char *pathopt; /* set by padvance */ diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 3de977c1..c4e63781 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -125,8 +125,7 @@ STATIC void synerror(const char *) __attribute__((__noreturn__)); STATIC void setprompt(int); -static inline int -isassignment(const char *p) +int isassignment(const char *p) { const char *q = endofname(p); if (p == q) diff --git a/usr/dash/parser.h b/usr/dash/parser.h index 2875cce6..524ac1c7 100644 --- a/usr/dash/parser.h +++ b/usr/dash/parser.h @@ -82,6 +82,7 @@ extern int...