From owner-svn-src-head@FreeBSD.ORG Mon Jun 30 20:54:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D8EA5684; Mon, 30 Jun 2014 20:54:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (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 BA8512477; Mon, 30 Jun 2014 20:54:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5UKsQYe015891; Mon, 30 Jun 2014 20:54:26 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5UKsQ5D015887; Mon, 30 Jun 2014 20:54:26 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201406302054.s5UKsQ5D015887@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 30 Jun 2014 20:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268066 - in head: lib/libc/regex sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2014 20:54:27 -0000 Author: pfg Date: Mon Jun 30 20:54:25 2014 New Revision: 268066 URL: http://svnweb.freebsd.org/changeset/base/268066 Log: 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 MFC after: 1 month Modified: head/lib/libc/regex/re_format.7 head/lib/libc/regex/regcomp.c head/sys/sys/param.h Modified: head/lib/libc/regex/re_format.7 ============================================================================== --- head/lib/libc/regex/re_format.7 Mon Jun 30 20:26:30 2014 (r268065) +++ head/lib/libc/regex/re_format.7 Mon Jun 30 20:54:25 2014 (r268066) @@ -36,7 +36,7 @@ .\" @(#)re_format.7 8.3 (Berkeley) 3/20/94 .\" $FreeBSD$ .\" -.Dd March 20, 1994 +.Dd June 30, 2014 .Dt RE_FORMAT 7 .Os .Sh NAME @@ -314,6 +314,13 @@ compatible with but not specified by .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, Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Mon Jun 30 20:26:30 2014 (r268065) +++ head/lib/libc/regex/regcomp.c Mon Jun 30 20:54:25 2014 (r268066) @@ -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; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jun 30 20:26:30 2014 (r268065) +++ head/sys/sys/param.h Mon Jun 30 20:54:25 2014 (r268066) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100024 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100025 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,