1: #include "check_confuse.h"
2: #include <string.h>
3:
4: int main(void)
5: {
6: cfg_opt_t opts[] = {
7: CFG_STR_LIST("stringproperty", 0, CFGF_NONE),
8: CFG_END()
9: };
10:
11: int rc;
12: cfg_t *cfg = cfg_init(opts, CFGF_NONE);
13:
14: fail_unless(cfg);
15:
16: rc = cfg_parse_buf(cfg,
17: " stringproperty = {\"this\"}\n"
18: " stringproperty += {\"that\"}\n"
19: " stringproperty += {\"other\"}\n");
20:
21: fail_unless(rc == CFG_SUCCESS);
22:
23: fail_unless(cfg_size(cfg, "stringproperty") == 3);
24:
25: fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 0), "this") == 0);
26: fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 1), "that") == 0);
27: fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 2), "other") == 0);
28:
29: rc = cfg_parse_buf(cfg,
30: " stringproperty = \"this\"\n"
31: " stringproperty += \"that\"\n"
32: " stringproperty += \"other\"\n");
33:
34: fail_unless(rc == CFG_SUCCESS);
35:
36: fail_unless(cfg_size(cfg, "stringproperty") == 3);
37:
38: fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 0), "this") == 0);
39: fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 1), "that") == 0);
40: fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 2), "other") == 0);
41:
42: cfg_free(cfg);
43:
44: return 0;
45: }
46:
47: /**
48: * Local Variables:
49: * indent-tabs-mode: t
50: * c-file-style: "linux"
51: * End:
52: */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>