From e65a8115208b95cb19c6fc55550ede5c3b82634d Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 11 Aug 2003 13:19:48 +0000 Subject: [PATCH] 18941: history wrong after parse error during alias expansion --- ChangeLog | 3 +++ Src/hist.c | 2 ++ Src/input.c | 14 ++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index e713a0e88..fb0f3b7fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2003-08-11 Peter Stephenson + * 18941: Src/hist.c, Src/input.c: Alias text could end up in + history after a parsing error during alias expansion. + * 18938: Src/lex.c, Src/Math.c, Src/Zle/zle_main.c, Src/Zle/compcore.c: Mark some data symbols for export, shutting up Cygwin's dllwrap. Note that c from zle_main.c is not marked diff --git a/Src/hist.c b/Src/hist.c index f1f240d3d..a25354f07 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -290,6 +290,8 @@ safeinungetc(int c) void herrflush(void) { + inpopalias(); + while (!lexstop && inbufct && !strin) hwaddc(ingetc()); } diff --git a/Src/input.c b/Src/input.c index e712ad19a..08ad4eb87 100644 --- a/Src/input.c +++ b/Src/input.c @@ -549,3 +549,17 @@ inpop(void) inpoptop(); } while (remcont); } + +/* + * Expunge any aliases from the input stack; they shouldn't appear + * in the history and need to be flushed explicitly when we encounter + * an error. + */ + +/**/ +void +inpopalias(void) +{ + while (inbufflags & INP_ALIAS) + inpoptop(); +}