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

Re: zsh -n and modules



> OK, so the problem is that `zsh -n' is executing math expressions.  It
> should probably treat math expressions just like any other builtin or
> command when the -n option is present; that is, do not execute them.

Is this the right place to fix this?

Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.36
diff -u -r1.36 subst.c
--- Src/subst.c	30 Aug 2003 19:12:18 -0000	1.36
+++ Src/subst.c	11 Mar 2004 16:20:38 -0000
@@ -168,7 +168,11 @@
 	    if (endchar == Outpar && str2[1] == '(' && str[-2] == ')') {
 		/* Math substitution of the form $((...)) */
 		str[-2] = '\0';
-		str = arithsubst(str2 + 2, &str3, str);
+		if (isset(EXECOPT)) {
+		    str = arithsubst(str2 + 2, &str3, str);
+		} else {
+		    strncpy(str3, str2, 1);
+		}
 		setdata(node, (void *) str3);
 		continue;
 	    }



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