Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: HIST_NO_STORE supports "builtin"



I noticed that my latest HIST_NO_STORE support wouldn't work if you
ran "builtin history" rather than just "history".  This fixes that,
but I didn't bother to worry about things like "noglob" or anything
else.

If anyone knows of a better way to do this matching (like maybe
compiling a pattern or something) please let me know.  I looked at the
underlying list data that the lexer generated, and it didn't look to
be useful for this test (unlike the HIST_NO_FUNCTIONS support, where
it was very useful).

..wayne..

---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index: Src/hist.c
@@ -965,21 +965,24 @@
 
     if (isset(HISTNOSTORE)) {
 	char *b = getpermtext(prog, NULL);
+	char *t = b;
+	if (*b == 'b' && strncmp(b, "builtin ", 8) == 0)
+	    b += 8;
 	if (*b == 'h' && strncmp(b, "history", 7) == 0
 	 && (!b[7] || b[7] == ' ')) {
-	    zsfree(b);
+	    zsfree(t);
 	    return 1;
 	}
 	if (*b == 'f' && b[1] == 'c' && b[2] == ' ' && b[3] == '-') {
 	    b += 3;
 	    do {
 		if (*++b == 'l') {
-		    zsfree(b);
+		    zsfree(t);
 		    return 1;
 		}
 	    } while (isalpha(*b));
 	}
-	zsfree(b);
+	zsfree(t);
     }
 
     return 0;
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---



Messages sorted by: Reverse Date, Date, Thread, Author