X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fconf-test.c;h=f4ca15fdb7fba7022eb8da4ad34c876df3e853e9;hb=0627298b50a1047167d98438102ff40897c42f3e;hp=458689de858fb2b740a5d006b07aecdfd170221e;hpb=a86e328ab75068b1c27e17e3fb33a9b5845f63aa;p=libucw.git diff --git a/lib/conf-test.c b/lib/conf-test.c index 458689de..f4ca15fd 100644 --- a/lib/conf-test.c +++ b/lib/conf-test.c @@ -30,10 +30,8 @@ static struct sub_sect_1 sec1 = { {}, "Charlie", 0, "WBAFC", { 0, -1}, DARY_ALLO static byte * init_sec_1(struct sub_sect_1 *s) { - if (s == &sec1) { // this is a static variable; skip clearing - DARY_LEN(sec1.list) = 3; // XXX: fix for the bug in DARY_ALLOC() + if (s == &sec1) // this is a static variable; skip clearing return NULL; - } s->name = "unknown"; s->level = "default"; s->confidence[0] = 5; @@ -85,6 +83,8 @@ static time_t t1, t2; static u32 ip; static int *look = DARY_ALLOC(int, 2, 2, 1); static u16 numbers[10] = { 2, 100, 1, 5 }; +static u32 bitmap1 = 0xff; +static u32 bitmap2 = 3; static byte * parse_u16(byte *string, u16 *ptr) @@ -152,6 +152,12 @@ static struct cf_section cf_top = { CF_IP("ip", &ip), CF_LOOKUP_DYN("look", &look, alphabet, 1000), CF_USER_ARY("numbers", numbers, &u16_type, 10), + CF_BITMAP_INT("bitmap1", &bitmap1), + CF_BITMAP_LOOKUP("bitmap2", &bitmap2, ((byte*[]) { + "one", "two", "three", "four", "five", "six", "seven", "eight", + "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "seventeen", + "eighteen", "nineteen", "twenty", NULL // hidden joke here + })), CF_END } }; @@ -164,7 +170,7 @@ static struct option long_opts[] = { }; static char *help = "\ -Usage: conf2-test \n\ +Usage: conf-test \n\ \n\ Options:\n" CF_USAGE @@ -187,7 +193,7 @@ main(int argc, char *argv[]) { log_init(argv[0]); cf_declare_section("top", &cf_top, 0); - cf_def_file = "lib/conf2.t"; + cf_def_file = "lib/conf-test.cf"; int opt; while ((opt = cf_getopt(argc, argv, short_opts, long_opts, NULL)) >= 0)