Beispiel #1
0
int find(struct session *ses, char *str, char *exp, int sub) {
  char expbuf[BUFFER_SIZE], strbuf[BUFFER_SIZE];

  if (ses) {
    substitute(ses, str, strbuf, SUB_VAR | SUB_FUN);
    substitute(ses, exp, expbuf, SUB_VAR | SUB_FUN);

    return tintin_regexp(ses, NULL, strbuf, expbuf, 0, sub);
  } else {
    return tintin_regexp(ses, NULL, str, exp, 0, sub);
  }
}
Beispiel #2
0
int check_one_regexp(struct session *ses, struct listnode *node, char *line, char *original, int option)
{
	char *exp, *str;

	if (node->regex == NULL)
	{
		char result[BUFFER_SIZE];

		substitute(ses, node->left, result, SUB_VAR|SUB_FUN);

		exp = result;
	}
	else
	{
		exp = node->left;
	}

	if (HAS_BIT(node->flags, NODE_FLAG_META))
	{
		exp++;
		str = original;
	}
	else
	{
		str = line;
	}	

	return tintin_regexp(ses, node->regex, str, exp, option, SUB_ARG);
}
Beispiel #3
0
int match(struct session *ses, char *str, char *exp, int flags) {
  char expbuf[BUFFER_SIZE];

  sprintf(expbuf, "^%s$", exp);

  substitute(ses, expbuf, expbuf, flags);

  return tintin_regexp(ses, NULL, str, expbuf, 0, 0);
}