added check for Hnum < 0 in findev(), to catch bogus entries added
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Tue, 27 Sep 1988 16:19:16 +0000 (08:19 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Tue, 27 Sep 1988 16:19:16 +0000 (08:19 -0800)
alias expansion

SCCS-vsn: bin/csh/lex.c 5.7

usr/src/bin/csh/lex.c

index 2f4ce4e..6973bc3 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char *sccsid = "@(#)lex.c       5.6 (Berkeley) %G%";
+static char *sccsid = "@(#)lex.c       5.7 (Berkeley) %G%";
 #endif
 
 #include "sh.h"
 #endif
 
 #include "sh.h"
@@ -1009,6 +1009,15 @@ findev(cp, anyarg)
                register struct wordent *lp = hp->Hlex.next;
                int argno = 0;
 
                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) {
                if (lp->word[0] == '\n')
                        continue;
                if (!anyarg) {