aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test-rewb-sysv.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-11-06 21:19:09 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-11-06 21:19:09 +0000
commitd53a7449dca8ec558ca0b6c322c6d3351afe1c8b (patch)
treeaa97bd8599814cfda433c5aa309a38be0804f4e2 /test-rewb-sysv.c
parent7ab4e1278a5b8ac4289c450b2bf85da2aad06ba4 (diff)
downloadmandoc-d53a7449dca8ec558ca0b6c322c6d3351afe1c8b.tar.gz
mandoc-d53a7449dca8ec558ca0b6c322c6d3351afe1c8b.tar.zst
mandoc-d53a7449dca8ec558ca0b6c322c6d3351afe1c8b.zip
In ./configure, select a RE syntax for word boundaries supported by libc;
issue reported by Svyatoslav Mishyn, Peter Bray, and Daniel Levai.
Diffstat (limited to 'test-rewb-sysv.c')
-rw-r--r--test-rewb-sysv.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test-rewb-sysv.c b/test-rewb-sysv.c
new file mode 100644
index 00000000..cb35c544
--- /dev/null
+++ b/test-rewb-sysv.c
@@ -0,0 +1,26 @@
+#include <sys/types.h>
+#include <regex.h>
+
+int
+main(void)
+{
+ regex_t re;
+
+ if (regcomp(&re, "\\<word\\>", REG_EXTENDED | REG_NOSUB))
+ return 1;
+ if (regexec(&re, "the word is here", 0, NULL, 0))
+ return 2;
+ if (regexec(&re, "same word", 0, NULL, 0))
+ return 3;
+ if (regexec(&re, "word again", 0, NULL, 0))
+ return 4;
+ if (regexec(&re, "word", 0, NULL, 0))
+ return 5;
+ if (regexec(&re, "wordy", 0, NULL, 0) != REG_NOMATCH)
+ return 6;
+ if (regexec(&re, "sword", 0, NULL, 0) != REG_NOMATCH)
+ return 7;
+ if (regexec(&re, "reworded", 0, NULL, 0) != REG_NOMATCH)
+ return 8;
+ return 0;
+}