summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--helper.c125
1 files changed, 63 insertions, 62 deletions
diff --git a/helper.c b/helper.c
index c7b4aaf..2dc907e 100644
--- a/helper.c
+++ b/helper.c
@@ -87,11 +87,11 @@ void helper_nonblock(const int fd)
static void helper_printavaInt(struct AttributeValueAssertion* a,const char* rel)
{
- printf("[%.*s %s", (int)a->desc.l, a->desc.s, rel);
+ printf("(%.*s%s", (int)a->desc.l, a->desc.s, rel);
if (a->value.l != 0 && a->value.s != NULL) {
- printf(" %.*s]", (int)a->value.l,a->value.s);
+ printf("%.*s)", (int)a->value.l,a->value.s);
} else {
- putchar(']');
+ putchar(')');
}
}
@@ -131,69 +131,70 @@ static void helper_printfilterInt(struct Filter* f)
printf("(nullfilter)");
return;
}
- switch (f->type) {
- case AND:
- printf("&(");
+ while (f != NULL) {
+ switch (f->type) {
+ case AND:
+ printf("(&");
mergesub:
- helper_printfilterInt(f->x);
- putchar(')');
- break;
- case OR:
- printf("|(");
- goto mergesub;
- case NOT:
- printf("!(");
- goto mergesub;
- case EQUAL:
- helper_printavaInt(&f->ava,"==");
- break;
- case SUBSTRING: {
- struct Substring* s=f->substrings;
- int first=1;
- printf("%.*s",(int)f->ava.desc.l,f->ava.desc.s);
- printf(" has ");
- while (s) {
- if (!first) {
- printf(" and ");
- }
- first=0;
- switch(s->substrtype) {
- case prefix:
- printf("prefix \"");
- break;
- case any:
- printf("substr \"");
- break;
- case suffix:
- printf("suffix \"");
- break;
+ helper_printfilterInt(f->x);
+ putchar(')');
+ break;
+ case OR:
+ printf("(|");
+ goto mergesub;
+ case NOT:
+ printf("(!");
+ goto mergesub;
+ case EQUAL:
+ helper_printavaInt(&f->ava,"=");
+ break;
+ case SUBSTRING: {
+ struct Substring* s=f->substrings;
+ int first=1;
+ printf("(%.*s",(int)f->ava.desc.l,f->ava.desc.s);
+ printf(" has ");
+ while (s) {
+ if (!first) {
+ printf(" and ");
+ }
+ first=0;
+ switch(s->substrtype) {
+ case prefix:
+ printf("prefix \"");
+ break;
+ case any:
+ printf("substr \"");
+ break;
+ case suffix:
+ printf("suffix \"");
+ break;
+ }
+ printf("%.*s\"",(int)s->s.l,s->s.s);
+ s=s->next;
}
- printf("%.*s",(int)s->s.l,s->s.s);
- putchar('"');
- s=s->next;
+ putchar(')');
}
- }
- break;
- case GREATEQUAL:
- helper_printavaInt(&f->ava,">=");
break;
- case LESSEQUAL:
- helper_printavaInt(&f->ava,"<=");
- break;
- case PRESENT:
- f->ava.value.l = 0;
- helper_printavaInt(&f->ava,"\\exist");
- break;
- case APPROX:
- helper_printavaInt(&f->ava,"\\approx");
- break;
- case EXTENSIBLE:
- printf("[extensible]");
- break;
- }
- if (f->next) {
- putchar(',');
- helper_printfilterInt(f->next);
+ case GREATEQUAL:
+ helper_printavaInt(&f->ava,">=");
+ break;
+ case LESSEQUAL:
+ helper_printavaInt(&f->ava,"<=");
+ break;
+ case PRESENT:
+ f->ava.value.l = 0;
+ helper_printavaInt(&f->ava,"=*");
+ break;
+ case APPROX:
+ helper_printavaInt(&f->ava,"~=");
+ break;
+ case EXTENSIBLE:
+ printf("[extensible]");
+ break;
+ default:
+ printf("????????");
+ }
+ f = f->next;
}
}