version 1.194, 2019/05/13 20:07:02 |
version 1.195, 2019/05/25 16:51:10 |
|
|
|
|
/* |
/* |
* Modifiers are a ; separated list of the forms: |
* Modifiers are a ; separated list of the forms: |
* l,m,C,b,d,t,q,E,T,S,W,P |
* l,m,C,b,d,t,q,E,T,S,W,P,<,> |
* =a |
* =a |
* =/a |
* =/a |
* =/a/ |
* =/a/ |
* s/a/b/ |
* s/a/b/ |
* s/a/b |
* s/a/b |
* ||,&&,!=,== |
* ||,&&,!=,==,<=,>= |
*/ |
*/ |
|
|
*count = 0; |
*count = 0; |
|
|
cp++; |
cp++; |
|
|
/* Check single character modifiers with no arguments. */ |
/* Check single character modifiers with no arguments. */ |
if (strchr("lmCbdtqETSWP", cp[0]) != NULL && |
if (strchr("lmCbdtqETSWP<>", cp[0]) != NULL && |
format_is_end(cp[1])) { |
format_is_end(cp[1])) { |
format_add_modifier(&list, count, cp, 1, NULL, 0); |
format_add_modifier(&list, count, cp, 1, NULL, 0); |
cp++; |
cp++; |
|
|
if ((memcmp("||", cp, 2) == 0 || |
if ((memcmp("||", cp, 2) == 0 || |
memcmp("&&", cp, 2) == 0 || |
memcmp("&&", cp, 2) == 0 || |
memcmp("!=", cp, 2) == 0 || |
memcmp("!=", cp, 2) == 0 || |
memcmp("==", cp, 2) == 0) && |
memcmp("==", cp, 2) == 0 || |
|
memcmp("<=", cp, 2) == 0 || |
|
memcmp(">=", cp, 2) == 0) && |
format_is_end(cp[2])) { |
format_is_end(cp[2])) { |
format_add_modifier(&list, count, cp, 2, NULL, 0); |
format_add_modifier(&list, count, cp, 2, NULL, 0); |
cp += 2; |
cp += 2; |
|
|
if (fm->size == 1) { |
if (fm->size == 1) { |
switch (fm->modifier[0]) { |
switch (fm->modifier[0]) { |
case 'm': |
case 'm': |
|
case '<': |
|
case '>': |
cmp = fm; |
cmp = fm; |
break; |
break; |
case 'C': |
case 'C': |
|
|
if (strcmp(fm->modifier, "||") == 0 || |
if (strcmp(fm->modifier, "||") == 0 || |
strcmp(fm->modifier, "&&") == 0 || |
strcmp(fm->modifier, "&&") == 0 || |
strcmp(fm->modifier, "==") == 0 || |
strcmp(fm->modifier, "==") == 0 || |
strcmp(fm->modifier, "!=") == 0) |
strcmp(fm->modifier, "!=") == 0 || |
|
strcmp(fm->modifier, ">=") == 0 || |
|
strcmp(fm->modifier, "<=") == 0) |
cmp = fm; |
cmp = fm; |
} |
} |
} |
} |
|
|
value = xstrdup("1"); |
value = xstrdup("1"); |
else |
else |
value = xstrdup("0"); |
value = xstrdup("0"); |
} |
} else if (strcmp(cmp->modifier, "<") == 0) { |
else if (strcmp(cmp->modifier, "m") == 0) { |
if (strcmp(left, right) < 0) |
|
value = xstrdup("1"); |
|
else |
|
value = xstrdup("0"); |
|
} else if (strcmp(cmp->modifier, ">") == 0) { |
|
if (strcmp(left, right) > 0) |
|
value = xstrdup("1"); |
|
else |
|
value = xstrdup("0"); |
|
} else if (strcmp(cmp->modifier, "<=") == 0) { |
|
if (strcmp(left, right) <= 0) |
|
value = xstrdup("1"); |
|
else |
|
value = xstrdup("0"); |
|
} else if (strcmp(cmp->modifier, ">=") == 0) { |
|
if (strcmp(left, right) >= 0) |
|
value = xstrdup("1"); |
|
else |
|
value = xstrdup("0"); |
|
} else if (strcmp(cmp->modifier, "m") == 0) { |
if (fnmatch(left, right, 0) == 0) |
if (fnmatch(left, right, 0) == 0) |
value = xstrdup("1"); |
value = xstrdup("1"); |
else |
else |