From d8989a72d4db82b1aec4821e7839cf23c17be8f7 Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Thu, 26 May 2016 13:33:53 +0000 Subject: support for testing REG_STARTEND together with REG_NOTBOL --- src/regress/lib/libc/regex/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/regress/lib/libc/regex/main.c b/src/regress/lib/libc/regex/main.c index e0ed86f5e8..92257a7179 100644 --- a/src/regress/lib/libc/regex/main.c +++ b/src/regress/lib/libc/regex/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.7 2007/09/12 19:32:35 otto Exp $ */ +/* $OpenBSD: main.c,v 1.8 2016/05/26 13:33:53 schwarze Exp $ */ /* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */ #include @@ -260,6 +260,9 @@ int opts; /* may not match f1 */ fprintf(stderr, "%d: bad STARTEND syntax\n", line); subs[0].rm_so = strchr(f2, '(') - f2 + 1; subs[0].rm_eo = strchr(f2, ')') - f2; + /* the preceding character is relevant with REG_NOTBOL */ + f2copy[subs[0].rm_so - 1] = subs[0].rm_so > 1 ? + f2copy[subs[0].rm_so - 2] : 'X'; } err = regexec(&re, f2copy, NSUBS, subs, options('e', f1)); -- cgit v1.2.3-55-g6feb