+ for (uns i=0; i<5; i++)
+ {
+ struct sub_sect_1 *s = xmalloc(sizeof(struct sub_sect_1)); // XXX: cannot by cf_malloc(), because it's deleted when cf_reload()'ed
+ cf_init_section("slaves", &cf_sec_1, s, 1);
+ s->confidence[1] = i;
+ clist_add_tail(&secs, &s->n);
+ }
+ return NULL;
+}
+
+static char *
+commit_top(void *ptr UNUSED)
+{
+ if (nr1 != 15)
+ return "Don't touch my variable!";
+ return NULL;
+}
+
+static char *alphabet[] = { "alpha", "beta", "gamma", "delta", NULL };
+static struct cf_section cf_top = {
+ CF_INIT(init_top),
+ CF_COMMIT(commit_top),
+ CF_ITEMS {
+ CF_UNS("nr1", &nr1),
+ CF_INT_DYN("nrs1", &nrs1, 1000),
+ CF_INT_ARY("nrs2", nrs2, 5),
+ CF_STRING("str1", &str1),
+ CF_STRING_DYN("str2", &str2, 20),
+ CF_U64("u1", &u1),
+ CF_DOUBLE("d1", &d1),
+ CF_PARSER("FirstTime", &t1, time_parser, -1),
+ CF_PARSER("SecondTime", &t2, time_parser, 1),
+ CF_SECTION("master", &sec1, &cf_sec_1),
+ CF_LIST("slaves", &secs, &cf_sec_1),
+ 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, ((char*[]) {
+ "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
+ }
+};
+
+static byte short_opts[] = CF_SHORT_OPTS "v";
+static struct option long_opts[] = {