X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fconf-dump.c;h=073bf129e4cd5096a2a11ca6c1a3dc609a993015;hb=859769b129993a67598d61bb36d72d268082276b;hp=ee137ab147615c797c4c7e14f2ebc49863d74bc2;hpb=894ab13170a1f14ec1920976c531fe02ffb5a2ab;p=libucw.git diff --git a/lib/conf-dump.c b/lib/conf-dump.c index ee137ab1..073bf129 100644 --- a/lib/conf-dump.c +++ b/lib/conf-dump.c @@ -48,8 +48,7 @@ dump_basic(struct fastbuf *fb, void *ptr, enum cf_type type, union cf_union *u) static void dump_section(struct fastbuf *fb, struct cf_section *sec, int level, void *ptr); -static byte *class_names[] = { "end", "static", "dynamic", "parser", "section", "list" }; -static byte *type_names[] = { "int", "u64", "double", "ip", "string", "lookup", "user" }; +static byte *class_names[] = { "end", "static", "dynamic", "parser", "section", "list", "bitmap" }; static void dump_item(struct fastbuf *fb, struct cf_item *item, int level, void *ptr) @@ -64,8 +63,8 @@ dump_item(struct fastbuf *fb, struct cf_item *item, int level, void *ptr) bputs(fb, "any "); else bprintf(fb, "%d ", item->number); - if (item->cls == CC_STATIC || item->cls == CC_DYNAMIC) { - bprintf(fb, "T%s ", type_names[type]); + if (item->cls == CC_STATIC || item->cls == CC_DYNAMIC || item->cls == CC_BITMAP) { + bprintf(fb, "T%s ", cf_type_names[type]); if (item->type == CT_USER) bprintf(fb, "U%s S%d ", item->u.utype->name, size); } @@ -81,6 +80,18 @@ dump_item(struct fastbuf *fb, struct cf_item *item, int level, void *ptr) dump_basic(fb, ptr + i * size, type, &item->u); } else bprintf(fb, "NULL "); + } else if (item->cls == CC_BITMAP) { + u32 mask = * (u32*) ptr; + for (i=0; i<32; i++) { + if (item->type == CT_LOOKUP && !item->u.lookup[i]) + break; + if (mask & (1<type == CT_INT) + bprintf(fb, "%d ", i); + else if (item->type == CT_LOOKUP) + bprintf(fb, "%s ", item->u.lookup[i]); + } + } } bputc(fb, '\n'); if (item->cls == CC_SECTION)