#include <ctype.h>
#include "cond.tab.h"
-#include "brum.h"
+#include "umpf.h"
#define OVECCOUNT 3
#define HASHSIZE 103
static struct variable*
find_var(char* name, char* value, struct list* hash)
{
- int n, found = 0;
+ int n;
struct variable *p;
n = get_bucket_number(name);
-
- if (isupper(*name)){
- LIST_FOREACH(p, hash + n)
- if (!strcasecmp(p->name,name)){
- found = 1;
- break;
- }
- } else {
- LIST_FOREACH(p, hash + n)
- if (!strcmp(p->name, name)){
- found = 1;
- break;
+ int nocase = isupper(*name);
+ LIST_FOREACH(p, hash + n)
+ if (!(nocase ? strcasecmp : strcmp)(p->name,name)){
+ if (value){
+ free(p->value);
+ p->value = value;
+ p->modified = 1;
}
- }
-
- if (found && value){
- free(p->value);
- p->value = value;
- p->modified = 1;
- } else if (found && !value)
- return p;
- else {
- p = xmalloc(sizeof(struct variable));
- p->name = name;
- p->value = (value? value:xstrdup(""));
- p->modified = 1;
-
- list_add_last(hash+n, &p->car);
- }
+ return p;
+ }
+ p = xmalloc(sizeof(struct variable));
+ p->name = xstrdup(name);
+ p->value = (value? value:xstrdup(""));
+ p->modified = 1;
+ list_add_last(hash+n, &p->car);
return p;
}
return regex_cmp(left,right);
case CC('!','~'):
return !regex_cmp(left,right);
+ default:
+ die("Brrrchlemst!");
} //TODO: add numbers
} else {
return (left || right) && !(left && right);
case '!':
return !left;
+ default:
+ die("Brrrchlemst!");
}
}
}
modify_headers(current_headers, hash);
a->e.headers = copy_headers(current_headers);
+ a->e.body_len = current_body->body_len;
+ a->e.body = xmalloc(a->e.body_len);
+ memcpy(a->e.body, current_body->body, a->e.body_len);
a->l = l;
a->r = r;
a->s = s;
}
}
+
+void
+get_default_mailbox(char* mb)
+{
+ default_mailbox = mb;
+}