dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ungetc is not cleared on error?
@ 2020-12-19 13:23 Denys Vlasenko
  2020-12-23  8:12 ` [PATCH] input: Clear unget on RESET Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Denys Vlasenko @ 2020-12-19 13:23 UTC (permalink / raw)
  To: Herbert Xu, DASH shell mailing list

Current git:

$ ;l
dash: 1: Syntax error: ";" unexpected
$ s
COPYING    ChangeLog.O    Makefile.am  aclocal.m4  autom4te.cache
config.h     config.log     configure       dash
dollar_altvalue1.tests  missing  stamp-h1
ChangeLog  Makefile    Makefile.in  autogen.sh  compile
config.h.in  config.status  configure.ac  depcomp  install-sh
  src      trace

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] input: Clear unget on RESET
  2020-12-19 13:23 ungetc is not cleared on error? Denys Vlasenko
@ 2020-12-23  8:12 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2020-12-23  8:12 UTC (permalink / raw)
  To: Denys Vlasenko; +Cc: DASH shell mailing list

On Sat, Dec 19, 2020 at 02:23:44PM +0100, Denys Vlasenko wrote:
> Current git:
> 
> $ ;l
> dash: 1: Syntax error: ";" unexpected
> $ s
> COPYING    ChangeLog.O    Makefile.am  aclocal.m4  autom4te.cache
> config.h     config.log     configure       dash
> dollar_altvalue1.tests  missing  stamp-h1
> ChangeLog  Makefile    Makefile.in  autogen.sh  compile
> config.h.in  config.status  configure.ac  depcomp  install-sh
>   src      trace

This patch fixes it by clearing ungetc on RESET.

Fixes: 17db43b58415 ("input: Allow two consecutive calls to pungetc")
Reported-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/src/input.c b/src/input.c
index 4987732..d7c101b 100644
--- a/src/input.c
+++ b/src/input.c
@@ -87,6 +87,7 @@ INIT {
 RESET {
 	/* clear input buffer */
 	basepf.lleft = basepf.nleft = 0;
+	basepf.unget = 0;
 	popallfiles();
 }
 
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-23  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-19 13:23 ungetc is not cleared on error? Denys Vlasenko
2020-12-23  8:12 ` [PATCH] input: Clear unget on RESET Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).