bin/153257: libc/regex: Add support for \< and \> word delimiters
Pedro F. Giffuni
giffunip at tutopia.com
Fri Dec 17 21:30:11 UTC 2010
>Number: 153257
>Category: bin
>Synopsis: libc/regex: Add support for \< and \> word delimiters
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Dec 17 21:30:10 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Pedro F. Giffuni
>Release: 8.1-RELEASE
>Organization:
>Environment:
FreeBSD mogwai.giffuni.net 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Tue Nov 9 10:31:43 UTC 2010 pedro at mogwai.giffuni.net:/usr/src/sys/i386/compile/GENERIC i386
>Description:
As part as a sed port for Illumos, Garrett D'Amore has updated
FreeBSD's regex from FreeBSD to include support for \< and \>,
as these are historically in wide use on Solaris.
This is in accordance to what gnu ans Solaris regex do.
The diff was taken from here:
https://www.illumos.org/issues/516
According to Garret's blog:
http://gdamore.blogspot.com/2010/12/i-sed1-so.html
(FreeBSD friends, please feel free to include these changes back -- I've not changed the original BSD license.)
>How-To-Repeat:
>Fix:
Patch attached.
Patch attached with submission follows:
diff -ru regex.orig/regcomp.c regex/regcomp.c
--- regex.orig/regcomp.c 2010-12-17 16:01:01.000000000 +0000
+++ regex/regcomp.c 2010-12-17 16:08:13.000000000 +0000
@@ -407,7 +407,17 @@
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);
@@ -564,6 +574,12 @@
case '[':
p_bracket(p);
break;
+ case BACKSL|'<':
+ EMIT(OBOW, 0);
+ break;
+ case BACKSL|'>':
+ EMIT(OEOW, 0);
+ break;
case BACKSL|'{':
SETERROR(REG_BADRPT);
break;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list