diff options
Diffstat (limited to 'helper.c')
-rw-r--r-- | helper.c | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -19,6 +19,8 @@ void bail(char *args, ...) vprintf(args, argList); va_end(argList); printf("\n"); + fflush(stdout); + fflush(stderr); exit(1); } @@ -79,7 +81,7 @@ void helper_nonblock(const int fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); } -void helper_printava(struct AttributeValueAssertion* a,const char* rel) +static void helper_printavaInt(struct AttributeValueAssertion* a,const char* rel) { putchar('['); printf("%.*s", (int)a->desc.l,a->desc.s); @@ -90,6 +92,12 @@ void helper_printava(struct AttributeValueAssertion* a,const char* rel) putchar(']'); } +void helper_printava(struct AttributeValueAssertion* a,const char* rel) +{ + helper_printavaInt(a, rel); + putchar('\n'); +} + void helper_printal(struct AttributeDescriptionList* a) { while (a) { @@ -102,14 +110,14 @@ void helper_printal(struct AttributeDescriptionList* a) putchar('\n'); } -void helper_printfilter(struct Filter* f) +static void helper_printfilterInt(struct Filter* f) { switch (f->type) { case AND: printf("&("); mergesub: - helper_printfilter(f->x); - printf(")\n"); + helper_printfilterInt(f->x); + printf(")"); break; case OR: printf("|("); @@ -119,7 +127,7 @@ mergesub: printf("!("); goto mergesub; case EQUAL: - helper_printava(&f->ava,"=="); + helper_printavaInt(&f->ava,"=="); break; case SUBSTRING: { struct Substring* s=f->substrings; @@ -149,16 +157,16 @@ mergesub: } break; case GREATEQUAL: - helper_printava(&f->ava,">="); + helper_printavaInt(&f->ava,">="); break; case LESSEQUAL: - helper_printava(&f->ava,"<="); + helper_printavaInt(&f->ava,"<="); break; case PRESENT: - helper_printava(&f->ava,"\\exist"); + helper_printavaInt(&f->ava,"\\exist"); break; case APPROX: - helper_printava(&f->ava,"\\approx"); + helper_printavaInt(&f->ava,"\\approx"); break; case EXTENSIBLE: printf("[extensible]"); @@ -166,9 +174,13 @@ mergesub: } if (f->next) { putchar(','); - helper_printfilter(f->next); + helper_printfilterInt(f->next); } +} + +void helper_printfilter(struct Filter* f) +{ + helper_printfilterInt(f); putchar('\n'); - fflush(stdout); } |