From 4a8b8bd7522df86d74bbfdb9c1086ae64ad6f861 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 6 Jul 2001 09:23:55 +0000 Subject: 15277: Src/glob.c: real backreferencing bug with ${(S)...%%...} --- Src/glob.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Src/glob.c') diff --git a/Src/glob.c b/Src/glob.c index 5be79329b..2f64434c4 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -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) -- cgit 1.4.1