aboutsummaryrefslogtreecommitdiff
path: root/posix/regexec.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-04 23:37:01 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-04 23:37:01 +0000
commit6fefb4e0b1695a4f7d0d18be6c04472bb3995071 (patch)
tree470549c3fb1120fcca55d882b9911a716b5c92b2 /posix/regexec.c
parent4c595adb603a70901433026153e1ff34979ed173 (diff)
downloadglibc-6fefb4e0b1695a4f7d0d18be6c04472bb3995071.zip
glibc-6fefb4e0b1695a4f7d0d18be6c04472bb3995071.tar.gz
glibc-6fefb4e0b1695a4f7d0d18be6c04472bb3995071.tar.bz2
Update.
2004-01-15 Paolo Bonzini <bonzini@gnu.org> * posix/regex.h (REG_STARTEND): Define. * posix/regexec.c (regexec): Check for REG_STARTEND.
Diffstat (limited to 'posix/regexec.c')
-rw-r--r--posix/regexec.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/posix/regexec.c b/posix/regexec.c
index cad676c..09142c5 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -215,13 +215,23 @@ regexec (preg, string, nmatch, pmatch, eflags)
int eflags;
{
reg_errcode_t err;
- int length = strlen (string);
+ int start, length;
+ if (eflags & REG_STARTEND)
+ {
+ start = pmatch[0].rm_so;
+ length = pmatch[0].rm_eo;
+ }
+ else
+ {
+ start = 0;
+ length = strlen (string);
+ }
if (preg->no_sub)
- err = re_search_internal (preg, string, length, 0, length, length, 0,
- NULL, eflags);
+ err = re_search_internal (preg, string, length, start, length - start,
+ length, 0, NULL, eflags);
else
- err = re_search_internal (preg, string, length, 0, length, length, nmatch,
- pmatch, eflags);
+ err = re_search_internal (preg, string, length, start, length - start,
+ length, nmatch, pmatch, eflags);
return err != REG_NOERROR;
}
#ifdef _LIBC