parser: Do not print prompt if input buffer is not empty
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 parser: Do not print prompt if input buffer is not empty
Quoted 5 lines · Jilles Tjoelker
I expect that the extra ugliness caused by this incomplete check will not be worth it. It would be better to enable libedit or to use a version of linenoise (link it statically to avoid the impact on
fork()performance).
I'm feeling generous so this patch works for me.
Quoted 5 lines
By the way, you can also have a "spurious" "$ ":
$ echo a^Jecho b a $ b $
It fixes this problem too.
Thanks,
---8<---
Do not print a prompt if there is still input left over in the input buffer.
Add a noinline attribute to setprompt while doing this as otherwise gcc will produce horrendous output.
Reported-by Vincent Lefevre <[email protected]>
Signed-off-by Herbert Xu <[email protected]>
src/parser.c +2 -3
@@ -1705,8 +1705,7 @@ synerror(const char *msg)/* NOTREACHED */ } -STATIC void -setprompt (int which) +static void __attribute__((noinline))setprompt (int which) {struct stackmark smark;int show;
@@ -1719,7 +1718,7 @@ setprompt(int which)#else show = !el;#endif -if (show) { +if (show && !parsefile->nleft) {pushstackmark (&smark,stackblocksize ());out2str (getprompt (NULL ));popstackmark (&smark);
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt