From owner-freebsd-bugs@FreeBSD.ORG Sat May 3 19:30:02 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB588BE8 for ; Sat, 3 May 2014 19:30:02 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F0F01B46 for ; Sat, 3 May 2014 19:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s43JU22K061464 for ; Sat, 3 May 2014 19:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s43JU2Dn061463; Sat, 3 May 2014 19:30:02 GMT (envelope-from gnats) Date: Sat, 3 May 2014 19:30:02 GMT Message-Id: <201405031930.s43JU2Dn061463@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Pedro Giffuni Subject: Re: bin/153257: [libc] [patch] regex(3): Add support for \< and \> word delimiters X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Pedro Giffuni List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2014 19:30:02 -0000 The following reply was made to PR bin/153257; it has been noted by GNATS. From: Pedro Giffuni To: "bug-followup@FreeBSD.org" Cc: Subject: Re: bin/153257: [libc] [patch] regex(3): Add support for \< and \> word delimiters Date: Sat, 03 May 2014 14:28:16 -0500 This is a multi-part message in MIME format. --------------000307060206030505090808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Updated patch to include documentation changes. --------------000307060206030505090808 Content-Type: text/plain; charset=us-ascii; name="patch-regex-svr4.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-regex-svr4.txt" Index: lib/libc/regex/re_format.7 =================================================================== --- lib/libc/regex/re_format.7 (revision 265253) +++ lib/libc/regex/re_format.7 (working copy) @@ -314,6 +314,13 @@ .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, Index: lib/libc/regex/regcomp.c =================================================================== --- lib/libc/regex/regcomp.c (revision 265253) +++ lib/libc/regex/regcomp.c (working copy) @@ -412,7 +412,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); @@ -569,10 +579,15 @@ case '[': p_bracket(p); break; + case BACKSL|'<': + EMIT(OBOW, 0); + break; + case BACKSL|'>': + EMIT(OEOW, 0); + break; case BACKSL|'{': SETERROR(REG_BADRPT); - break; - case BACKSL|'(': + break; case BACKSL|'(': p->g->nsub++; subno = p->g->nsub; if (subno < NPAREN) --------------000307060206030505090808--