changed operators ^= to =^ and $= to =$; introduced clean and ./waf

personal/stbuehler/wip
Thomas Porzelt 14 years ago
parent aeba5c0080
commit c2b8ccdec4
  1. 20
      src/condition.c
  2. 6
      src/condition.h
  3. 8
      src/config_parser.rl

@ -112,7 +112,9 @@ condition* condition_new_string(server *srv, comp_operator_t op, condition_lvalu
case CONFIG_COND_EQ:
case CONFIG_COND_NE:
case CONFIG_COND_PREFIX:
case CONFIG_COND_NOPREFIX:
case CONFIG_COND_SUFFIX:
case CONFIG_COND_NOSUFFIX:
return cond_new_string(op, lvalue, str);
case CONFIG_COND_MATCH:
case CONFIG_COND_NOMATCH:
@ -142,7 +144,9 @@ condition* condition_new_int(server *srv, comp_operator_t op, condition_lvalue *
condition *c;
switch (op) {
case CONFIG_COND_PREFIX:
case CONFIG_COND_NOPREFIX:
case CONFIG_COND_SUFFIX:
case CONFIG_COND_NOSUFFIX:
case CONFIG_COND_MATCH:
case CONFIG_COND_NOMATCH:
case CONFIG_COND_IP:
@ -207,8 +211,10 @@ const char* comp_op_to_string(comp_operator_t op) {
switch (op) {
case CONFIG_COND_EQ: return "==";
case CONFIG_COND_NE: return "!=";
case CONFIG_COND_PREFIX: return "^=";
case CONFIG_COND_SUFFIX: return "$=";
case CONFIG_COND_PREFIX: return "=^";
case CONFIG_COND_NOPREFIX: return "=^";
case CONFIG_COND_SUFFIX: return "=$";
case CONFIG_COND_NOSUFFIX: return "!$";
case CONFIG_COND_MATCH: return "=~";
case CONFIG_COND_NOMATCH: return "!~";
case CONFIG_COND_IP: return "=/";
@ -301,9 +307,15 @@ static gboolean condition_check_eval_string(server *srv, connection *con, condit
case CONFIG_COND_PREFIX:
result = g_str_has_prefix(value, cond->rvalue.string->str);
break;
case CONFIG_COND_NOPREFIX:
result = !g_str_has_prefix(value, cond->rvalue.string->str);
break;
case CONFIG_COND_SUFFIX:
result = g_str_has_suffix(value, cond->rvalue.string->str);
break;
case CONFIG_COND_NOSUFFIX:
result = !g_str_has_suffix(value, cond->rvalue.string->str);
break;
case CONFIG_COND_MATCH:
case CONFIG_COND_NOMATCH:
#ifdef HAVE_PCRE_H
@ -357,7 +369,9 @@ static gboolean condition_check_eval_int(server *srv, connection *con, condition
case CONFIG_COND_GE: /** >= */
return (value >= cond->rvalue.i);
case CONFIG_COND_PREFIX:
case CONFIG_COND_NOPREFIX:
case CONFIG_COND_SUFFIX:
case CONFIG_COND_NOSUFFIX:
case CONFIG_COND_MATCH:
case CONFIG_COND_NOMATCH:
case CONFIG_COND_IP:
@ -473,7 +487,9 @@ static gboolean condition_check_eval_ip(server *srv, connection *con, condition
case CONFIG_COND_NOTIP:
return !ip_in_net(&ipval, &cond->rvalue);
case CONFIG_COND_PREFIX:
case CONFIG_COND_NOPREFIX:
case CONFIG_COND_SUFFIX:
case CONFIG_COND_NOSUFFIX:
case CONFIG_COND_EQ:
case CONFIG_COND_NE:
case CONFIG_COND_MATCH:

@ -21,8 +21,10 @@ typedef enum {
CONFIG_COND_NE, /** != */
/* only with string */
CONFIG_COND_PREFIX, /** ^= */
CONFIG_COND_SUFFIX, /** $= */
CONFIG_COND_PREFIX, /** =^ */
CONFIG_COND_NOPREFIX,/** !^ */
CONFIG_COND_SUFFIX, /** =$ */
CONFIG_COND_NOSUFFIX,/** !$ */
/* only usable with pcre */
CONFIG_COND_MATCH, /** =~ */

@ -360,8 +360,10 @@
else if (*ctx->mark == '<' && *(ctx->mark+1) == '=') ctx->op = CONFIG_COND_LE;
else if (*ctx->mark == '=' && *(ctx->mark+1) == '=') ctx->op = CONFIG_COND_EQ;
else if (*ctx->mark == '!' && *(ctx->mark+1) == '=') ctx->op = CONFIG_COND_NE;
else if (*ctx->mark == '^' && *(ctx->mark+1) == '=') ctx->op = CONFIG_COND_PREFIX;
else if (*ctx->mark == '$' && *(ctx->mark+1) == '=') ctx->op = CONFIG_COND_SUFFIX;
else if (*ctx->mark == '=' && *(ctx->mark+1) == '^') ctx->op = CONFIG_COND_PREFIX;
else if (*ctx->mark == '!' && *(ctx->mark+1) == '^') ctx->op = CONFIG_COND_NOPREFIX;
else if (*ctx->mark == '=' && *(ctx->mark+1) == '$') ctx->op = CONFIG_COND_SUFFIX;
else if (*ctx->mark == '!' && *(ctx->mark+1) == '$') ctx->op = CONFIG_COND_NOSUFFIX;
else if (*ctx->mark == '=' && *(ctx->mark+1) == '~') ctx->op = CONFIG_COND_MATCH;
else if (*ctx->mark == '!' && *(ctx->mark+1) == '~') ctx->op = CONFIG_COND_NOMATCH;
}
@ -686,7 +688,7 @@
value_statement = ( value (ws* ('+'|'-'|'*'|'/') >value_statement_op ws* value %value_statement)? );
hash_elem = ( string >mark noise* ':' noise* value );
operator = ( '==' | '!=' | '^=' | '$=' | '<' | '<=' | '>' | '>=' | '=~' | '!~' ) >mark %operator;
operator = ( '==' | '!=' | '=^' | '!^' | '=$' | '!$' | '<' | '<=' | '>' | '>=' | '=~' | '!~' ) >mark %operator;
# statements
assignment = ( varname ws* '=' ws* value_statement ';' ) %assignment;

Loading…
Cancel
Save