xref: /freebsd/contrib/mandoc/test-rewb-sysv.c (revision 01d4e2149e5566e5d9394913dc9fb032da259e0b)
1 #include <sys/types.h>
2 #include <stddef.h>
3 #include <regex.h>
4 
5 int
main(void)6 main(void)
7 {
8 	regex_t	 re;
9 
10 	if (regcomp(&re, "\\<word\\>", REG_EXTENDED | REG_NOSUB))
11 		return 1;
12 	if (regexec(&re, "the word is here", 0, NULL, 0))
13 		return 2;
14 	if (regexec(&re, "same word", 0, NULL, 0))
15 		return 3;
16 	if (regexec(&re, "word again", 0, NULL, 0))
17 		return 4;
18 	if (regexec(&re, "word", 0, NULL, 0))
19 		return 5;
20 	if (regexec(&re, "wordy", 0, NULL, 0) != REG_NOMATCH)
21 		return 6;
22 	if (regexec(&re, "sword", 0, NULL, 0) != REG_NOMATCH)
23 		return 7;
24 	if (regexec(&re, "reworded", 0, NULL, 0) != REG_NOMATCH)
25 		return 8;
26 	return 0;
27 }
28