From 3ea14f234f461a7ebe3d4407808e1086acf00a8a Mon Sep 17 00:00:00 2001 From: Edward Wang Date: Tue, 27 Sep 1988 08:19:16 -0800 Subject: [PATCH] added check for Hnum < 0 in findev(), to catch bogus entries added alias expansion SCCS-vsn: bin/csh/lex.c 5.7 --- usr/src/bin/csh/lex.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/usr/src/bin/csh/lex.c b/usr/src/bin/csh/lex.c index 2f4ce4e8a5..6973bc393e 100644 --- a/usr/src/bin/csh/lex.c +++ b/usr/src/bin/csh/lex.c @@ -5,7 +5,7 @@ */ #ifndef lint -static char *sccsid = "@(#)lex.c 5.6 (Berkeley) %G%"; +static char *sccsid = "@(#)lex.c 5.7 (Berkeley) %G%"; #endif #include "sh.h" @@ -1009,6 +1009,15 @@ findev(cp, anyarg) register struct wordent *lp = hp->Hlex.next; int argno = 0; + /* + * The entries added by alias substitution don't + * have a newline but do have a negative event number. + * Savehist() trims off these entries, but it happens + * before alias expansion, too early to delete those + * from the previous command. + */ + if (hp->Hnum < 0) + continue; if (lp->word[0] == '\n') continue; if (!anyarg) { -- 2.20.1