File: test-rewb-bsd.c

package info (click to toggle)
mdocml 1.14.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,096 kB
  • sloc: ansic: 34,421; makefile: 994; sh: 461; perl: 374
file content (27 lines) | stat: -rw-r--r-- 618 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <sys/types.h>
#include <stddef.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;
}