1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-30 02:52:12 +01:00

15277: Src/glob.c: real backreferencing bug with ${(S)...%%...}

This commit is contained in:
Peter Stephenson 2001-07-06 09:23:55 +00:00
parent 40e17d980f
commit 4a8b8bd752
2 changed files with 12 additions and 8 deletions

View file

@ -1,5 +1,8 @@
2001-07-06 Peter Stephenson <pws@csr.com>
* 15277: Src/glob.c: *real* bug with ${(S)...%%...}: the indices
for start and end of backreferences were incorrect.
* Back out 15266: it was right before, I was looking at it
back to front.

View file

@ -2236,16 +2236,17 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr)
break;
case (SUB_END|SUB_SUBSTR):
/* Shortest at end with substrings */
patoffset = ml;
set_pat_start(p, l);
if (pattry(p, s + l) && !--n) {
*sp = get_match_ret(*sp, l, l, fl, replstr);
patoffset = 0;
return 1;
} /* fall through */
case (SUB_END|SUB_LONG|SUB_SUBSTR):
/* Longest/shortest at end, matching substrings. */
patoffset = ml;
if (!(fl & SUB_LONG)) {
set_pat_start(p, l);
if (pattry(p, s + l) && !--n) {
*sp = get_match_ret(*sp, l, l, fl, replstr);
patoffset = 0;
return 1;
}
}
patoffset--;
for (t = s + l - 1; t >= s; t--, patoffset--) {
if (t > s && t[-1] == Meta)