Index: ossp-pkg/l2/TODO RCS File: /v/ossp/cvs/ossp-pkg/l2/TODO,v rcsdiff -q -kk '-r1.49' '-r1.50' -u '/v/ossp/cvs/ossp-pkg/l2/TODO,v' 2>/dev/null --- TODO 2001/12/22 22:23:43 1.49 +++ TODO 2001/12/22 22:24:40 1.50 @@ -39,8 +39,6 @@ - l2_ch_socket bind and udp parameters need work. (RSE: why and what?) - l2_ch_socket consider taking a fd at configuration. -- l2_ch_filter should have a PCRE_CASELESS option. - - l2_ch_pcre is too large and might benefit from a smaller set of pattern matching logic. Index: ossp-pkg/l2/l2_ch_filter.c RCS File: /v/ossp/cvs/ossp-pkg/l2/l2_ch_filter.c,v rcsdiff -q -kk '-r1.14' '-r1.15' -u '/v/ossp/cvs/ossp-pkg/l2/l2_ch_filter.c,v' 2>/dev/null --- l2_ch_filter.c 2001/11/07 13:05:20 1.14 +++ l2_ch_filter.c 2001/12/22 22:24:40 1.15 @@ -34,6 +34,7 @@ typedef struct { char *szRegex; int bNegate; + int bNoCase; pcre *pcreRegex; pcre_extra *pcreExtra; } l2_ch_filter_t; @@ -49,7 +50,8 @@ /* initialize configuration with reasonable defaults */ cfg->szRegex = NULL; - cfg->bNegate = 0; + cfg->bNegate = FALSE; + cfg->bNoCase = FALSE; cfg->pcreRegex = NULL; cfg->pcreExtra = NULL; @@ -64,15 +66,17 @@ { l2_ch_filter_t *cfg = (l2_ch_filter_t *)ctx->vp; l2_env_t *env; - l2_param_t pa[3]; + l2_param_t pa[4]; l2_result_t rv; const char *szError; int nErrorOffset; + int opt; /* feed and call generic parameter parsing engine */ L2_PARAM_SET(pa[0], regex, STR, &cfg->szRegex); L2_PARAM_SET(pa[1], negate, INT, &cfg->bNegate); - L2_PARAM_END(pa[2]); + L2_PARAM_SET(pa[2], nocase, INT, &cfg->bNoCase); + L2_PARAM_END(pa[3]); l2_channel_env(ch, &env); if ((rv = l2_util_setparams(env, pa, fmt, ap)) != L2_OK) return rv; @@ -80,7 +84,10 @@ /* translate regular expression into finite state machine */ if (cfg->szRegex != NULL) { /* compile regular expression into FSM */ - if ((cfg->pcreRegex = pcre_compile(cfg->szRegex, 0, &szError, &nErrorOffset, NULL)) == NULL) { + opt = 0; + if (cfg->bNoCase) + opt |= PCRE_CASELESS; + if ((cfg->pcreRegex = pcre_compile(cfg->szRegex, opt, &szError, &nErrorOffset, NULL)) == NULL) { l2_env_errorinfo(env, L2_ERR_ARG, "%s ('%c')", szError, cfg->szRegex[nErrorOffset]); return L2_ERR_ARG; }