diff options
author | pfg <pfg@FreeBSD.org> | 2014-08-03 18:39:11 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-08-03 18:39:11 +0000 |
commit | 1ae0bcf0e879a946e377c83383d95d35555ec283 (patch) | |
tree | 8300ef9596b1127df1e405ddc23a1e2f5d5ec5c1 /lib/libc/regex/regcomp.c | |
parent | 4edbce8b348a54d29189a62a9b6e7b2212efa95c (diff) | |
download | FreeBSD-src-1ae0bcf0e879a946e377c83383d95d35555ec283.zip FreeBSD-src-1ae0bcf0e879a946e377c83383d95d35555ec283.tar.gz |
MFC r268066:
regex(3): Add support for \< and \> word delimiters
Solaris and other OSs have support for \< and \> as word
delimiters in utilities like sed(1). These are useful to
have for general compatiblity with Solaris but should be
avoided for portability with other systems, including the
traditional BSDs.
Bump __FreeBSD_version as this is likely to affect some
userland utilities.
Reference:
https://www.illumos.org/issues/516
PR: bin/153257
Obtained from: Illumos
Diffstat (limited to 'lib/libc/regex/regcomp.c')
-rw-r--r-- | lib/libc/regex/regcomp.c | 18 |
1 files changed, 17 insertions, 1 deletions
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; |