diff options
author | 2016-05-26 13:33:53 +0000 | |
---|---|---|
committer | 2016-05-26 13:33:53 +0000 | |
commit | 880d559d0739cd9e71850378c28ca70fc8b519a4 (patch) | |
tree | ccb73c08a183d7ea3f00d9de674d2027f749d880 /regress/lib/libc/regex/main.c | |
parent | fputs(3) now returns a non-negative number (as opposed to 0) on successful (diff) | |
download | wireguard-openbsd-880d559d0739cd9e71850378c28ca70fc8b519a4.tar.xz wireguard-openbsd-880d559d0739cd9e71850378c28ca70fc8b519a4.zip |
support for testing REG_STARTEND together with REG_NOTBOL
Diffstat (limited to '')
-rw-r--r-- | regress/lib/libc/regex/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/regress/lib/libc/regex/main.c b/regress/lib/libc/regex/main.c index e0ed86f5e8f..92257a71797 100644 --- a/regress/lib/libc/regex/main.c +++ b/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 <stdio.h> @@ -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)); |