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

PATCH: 3.1.5-pws-14: Re: bar='#pat'; ${foo/$bar/...} problem



On Apr 2,  2:39am, Bart Schaefer wrote:
} Subject: Re: bar='#pat'; ${foo/$bar/...} problem
}
} Now, you might argue that the implementation of /# and /% should be as
} if # and % are extensions of the glob syntax

Index: Src/subst.c
===================================================================
--- subst.c	1999/03/29 21:45:50	1.22
+++ subst.c	1999/04/02 11:06:21
@@ -1361,7 +1361,19 @@
 			 NULL, s[-1]);
 		    return NULL;
 		}
-	    singsub(&s);
+	    {
+		char t = s[-1];
+
+		singsub(&s);
+		if (t == '/' && (flags & SUB_SUBSTR)) {
+		    if (*s == '#' || *s == '%') {
+			flags &= ~SUB_SUBSTR;
+			if (*s == '%')
+			    flags |= SUB_END;
+			s++;
+		    }
+		}
+	    }
 
 	    if (!vunset && isarr) {
 		char **ap = aval;

} (Did I get to be article 6000? :-)

(Hopefully, I did a better job of patching than I did of noticing which
message's headers I was reading the X-Seq: from.  Hard to be 6000 when
that's the one you're replying to.)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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