Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/tre/dist/lib implement the REG_STARTEND extensi...
details: https://anonhg.NetBSD.org/src/rev/74172740796b
branches: trunk
changeset: 754171:74172740796b
user: agc <agc%NetBSD.org@localhost>
date: Thu Apr 22 17:33:54 2010 +0000
description:
implement the REG_STARTEND extension using tre_regnexec - REG_STARTEND is
used by mail(1), and file(1), to name but two.
diffstat:
external/bsd/tre/dist/lib/regexec.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r 4ac6960e2fda -r 74172740796b external/bsd/tre/dist/lib/regexec.c
--- a/external/bsd/tre/dist/lib/regexec.c Thu Apr 22 17:32:37 2010 +0000
+++ b/external/bsd/tre/dist/lib/regexec.c Thu Apr 22 17:33:54 2010 +0000
@@ -213,7 +213,20 @@
tre_regexec(const regex_t *preg, const char *str,
size_t nmatch, regmatch_t pmatch[], int eflags)
{
- return tre_regnexec(preg, str, (unsigned)-1, nmatch, pmatch, eflags);
+ const char *newstr;
+ unsigned newflags;
+ size_t newlen;
+
+ if (eflags & REG_STARTEND) {
+ newstr = &str[pmatch[0].rm_so];
+ newlen = pmatch[0].rm_eo;
+ newflags = (unsigned)(eflags & ~REG_STARTEND);
+ } else {
+ newstr = str;
+ newlen = (size_t)-1;
+ newflags = (unsigned)eflags;
+ }
+ return tre_regnexec(preg, newstr, newlen, nmatch, pmatch, (int)newflags);
}
Home |
Main Index |
Thread Index |
Old Index