JWM Source Documentation
match.c
Go to the documentation of this file.
1 
10 #include "jwm.h"
11 #include "match.h"
12 
13 #include <regex.h>
14 
16 char Match(const char *pattern, const char *expression)
17 {
18 
19  regex_t re;
20  regmatch_t rm;
21  int rc;
22 
23  if(!pattern && !expression) {
24  return 1;
25  } else if(!pattern || !expression) {
26  return 0;
27  }
28 
29  if(regcomp(&re, pattern, REG_EXTENDED) != 0) {
30  return 0;
31  }
32 
33  rc = regexec(&re, expression, 0, &rm, 0);
34 
35  regfree(&re);
36 
37  return rc == 0 ? 1 : 0;
38 
39 }
40 

joewing.net / Projects / JWM