Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jun 1999 22:37:57 +0200
From:      Tor.Egge@fast.no
To:        mi@aldan.algebra.com
Cc:        gnats-admin@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/12137: something wrong with shell -- functions with arithm expressions
Message-ID:  <199906112037.WAA34835@midten.fast.no>
In-Reply-To: Your message of "Fri, 11 Jun 1999 13:14:17 -0400 (EDT)"
References:  <199906111714.NAA58200@misha.cisco.com>

next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Fri_Jun_11_22:35:49_1999)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> Again, bash and ksh print out 15 for all of the strings...

So will /bin/sh, if you apply the enclosed patch:

- Tor Egge


----Next_Part(Fri_Jun_11_22:35:49_1999)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Index: expand.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/expand.c,v
retrieving revision 1.28
diff -u -r1.28 expand.c
--- expand.c	1999/05/08 10:21:49	1.28
+++ expand.c	1999/06/11 20:34:20
@@ -679,11 +679,13 @@
 	if (set && subtype != VSPLUS) {
 		/* insert the value of the variable */
 		if (special) {
-			varvalue(var, varflags & VSQUOTE, flag & EXP_FULL);
 			if (subtype == VSLENGTH) {
+				varvalue(var, 0, flag & EXP_FULL);
 				varlen = expdest - stackblock() - startloc;
 				STADJUST(-varlen, expdest);
-			}
+			} else
+				varvalue(var, varflags & VSQUOTE,
+					 flag & EXP_FULL);
 		} else {
 			char const *syntax = (varflags & VSQUOTE) ? DQSYNTAX
 								  : BASESYNTAX;

----Next_Part(Fri_Jun_11_22:35:49_1999)----


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906112037.WAA34835>