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
This commit is contained in:
parent
9377416d34
commit
1b1577745c
@ -36,7 +36,7 @@
|
|||||||
.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94
|
.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 20, 1994
|
.Dd June 30, 2014
|
||||||
.Dt RE_FORMAT 7
|
.Dt RE_FORMAT 7
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -314,6 +314,13 @@ compatible with but not specified by
|
|||||||
.St -p1003.2 ,
|
.St -p1003.2 ,
|
||||||
and should be used with
|
and should be used with
|
||||||
caution in software intended to be portable to other systems.
|
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
|
.Pp
|
||||||
In the event that an RE could match more than one substring of a given
|
In the event that an RE could match more than one substring of a given
|
||||||
string,
|
string,
|
||||||
|
@ -412,7 +412,17 @@ p_ere_exp(struct parse *p)
|
|||||||
case '\\':
|
case '\\':
|
||||||
(void)REQUIRE(MORE(), REG_EESCAPE);
|
(void)REQUIRE(MORE(), REG_EESCAPE);
|
||||||
wc = WGETNEXT();
|
wc = WGETNEXT();
|
||||||
ordinary(p, wc);
|
switch (wc) {
|
||||||
|
case '<':
|
||||||
|
EMIT(OBOW, 0);
|
||||||
|
break;
|
||||||
|
case '>':
|
||||||
|
EMIT(OEOW, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ordinary(p, wc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '{': /* okay as ordinary except if digit follows */
|
case '{': /* okay as ordinary except if digit follows */
|
||||||
(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
|
(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
|
||||||
@ -569,6 +579,12 @@ p_simp_re(struct parse *p,
|
|||||||
case '[':
|
case '[':
|
||||||
p_bracket(p);
|
p_bracket(p);
|
||||||
break;
|
break;
|
||||||
|
case BACKSL|'<':
|
||||||
|
EMIT(OBOW, 0);
|
||||||
|
break;
|
||||||
|
case BACKSL|'>':
|
||||||
|
EMIT(OEOW, 0);
|
||||||
|
break;
|
||||||
case BACKSL|'{':
|
case BACKSL|'{':
|
||||||
SETERROR(REG_BADRPT);
|
SETERROR(REG_BADRPT);
|
||||||
break;
|
break;
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
* in the range 5 to 9.
|
* in the range 5 to 9.
|
||||||
*/
|
*/
|
||||||
#undef __FreeBSD_version
|
#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,
|
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user