Date: Fri, 17 Dec 2010 21:25:23 GMT From: "Pedro F. Giffuni" <giffunip@tutopia.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/153257: libc/regex: Add support for \< and \> word delimiters Message-ID: <201012172125.oBHLPNCV068102@red.freebsd.org> Resent-Message-ID: <201012172130.oBHLUApd039684@freefall.freebsd.org>
index | next in thread | raw e-mail
>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@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:help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012172125.oBHLPNCV068102>
