summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/regex')
-rw-r--r--lib/libc/regex/re_format.79
-rw-r--r--lib/libc/regex/regcomp.c18
2 files changed, 25 insertions, 2 deletions
diff --git a/lib/libc/regex/re_format.7 b/lib/libc/regex/re_format.7
index a2a527d..05b1494 100644
--- a/lib/libc/regex/re_format.7
+++ b/lib/libc/regex/re_format.7
@@ -36,7 +36,7 @@
.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94
.\" $FreeBSD$
.\"
-.Dd March 20, 1994
+.Dd June 30, 2014
.Dt RE_FORMAT 7
.Os
.Sh NAME
@@ -314,6 +314,13 @@ compatible with but not specified by
.St -p1003.2 ,
and should be used with
caution in software intended to be portable to other systems.
+The additional word delimiters
+.Ql \e<
+and
+.Ql \e>
+are provided to ease compatibility with traditional
+.Xr svr4 4
+systems but are not portable and should be avoided.
.Pp
In the event that an RE could match more than one substring of a given
string,
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index 55f9c04..a01bb95 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -412,7 +412,17 @@ p_ere_exp(struct parse *p)
case '\\':
(void)REQUIRE(MORE(), REG_EESCAPE);
wc = WGETNEXT();
- ordinary(p, wc);
+ switch (wc) {
+ case '<':
+ EMIT(OBOW, 0);
+ break;
+ case '>':
+ EMIT(OEOW, 0);
+ break;
+ default:
+ ordinary(p, wc);
+ break;
+ }
break;
case '{': /* okay as ordinary except if digit follows */
(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
@@ -569,6 +579,12 @@ p_simp_re(struct parse *p,
case '[':
p_bracket(p);
break;
+ case BACKSL|'<':
+ EMIT(OBOW, 0);
+ break;
+ case BACKSL|'>':
+ EMIT(OEOW, 0);
+ break;
case BACKSL|'{':
SETERROR(REG_BADRPT);
break;
OpenPOWER on IntegriCloud