- unsigned long b, a = evaladd(st, d);
- int less, eq;
- for (;;) {
- if (*st->s != '<' && *st->s != '>')
- return a;
- less = st->s[0] == '<';
- eq = st->s[1] == '=';
- st->s += 1 + eq;
- b = evaladd(st, d);
- a = (less ? a < b : a > b) || (eq && a == b);
- }
-}
-
-static unsigned long evaleq(struct st *st, int d)
-{
- unsigned long a = evalrel(st, d);
- int c;
- for (;;) {
- c = st->s[0];
- if ((c != '=' && c != '!') || st->s[1] != '=')
- return a;
- st->s += 2;
- a = (evalrel(st, d) == a) ^ (c == '!');
- }
-}
-
-static unsigned long evaland(struct st *st, int d)
-{
- unsigned long a = evaleq(st, d);
- for (;;) {
- if (st->s[0] != '&' || st->s[1] != '&')
- return a;
- st->s += 2;
- a = evaleq(st, d) && a;
- }
+ static const char opch[11] = "|&=!><+-*%/";
+ static const char opch2[6] = "|&====";
+ int i;
+ for (i=0; i<11; i++)
+ if (*s == opch[i]) {
+ /* note: >,< are accepted with or without = */
+ if (i<6 && s[1] == opch2[i]) {
+ st->op = i;
+ return s+2;
+ }
+ if (i>=4) {
+ st->op = i+2;
+ return s+1;
+ }
+ break;
+ }
+ st->op = 13;
+ return s;