Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 May 2014 19:30:02 GMT
From:      Pedro Giffuni <pfg@freebsd.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/153257: [libc] [patch] regex(3): Add support for \< and \> word delimiters
Message-ID:  <201405031930.s43JU2Dn061463@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/153257; it has been noted by GNATS.

From: Pedro Giffuni <pfg@freebsd.org>
To: "bug-followup@FreeBSD.org" <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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405031930.s43JU2Dn061463>