On Sat, Mar 01, 2014 at 03:42:45PM +0100, Jilles Tjoelker wrote: > > 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. > 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]> diff --git a/src/parser.c b/src/parser.c index 412e876..4e8daf7 100644 --- a/src/parser.c +++ b/src/parser.c @@ -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); -- Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

