[BACK]Return to test-rewb-sysv.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

File: [cvsweb.bsd.lv] / mandoc / test-rewb-sysv.c (download)

Revision 1.2, Wed May 18 20:43:32 2016 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5, VERSION_1_14_4, VERSION_1_14_3, VERSION_1_14_2, VERSION_1_14_1, VERSION_1_13_4, VERSION_1_13, HEAD
Changes since 1.1: +1 -0 lines

Linux needs <stddef.h>, or NULL isn't defined.

#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;
}