From d308f3fc8db7d3b7b9e9185cbe353a491988082e Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sun, 19 May 2024 18:24:38 +0200 Subject: Update any_ini --- test/ini.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'test/ini.c') diff --git a/test/ini.c b/test/ini.c index 3097e98..49b39cc 100644 --- a/test/ini.c +++ b/test/ini.c @@ -2,36 +2,36 @@ #include #define ANY_INI_IMPLEMENT +#define ANY_INI_DELIM_COMMENT2 '#' #include "any_ini.h" int main() { const char *src = - "ciao = 10\n" - "global = yes\n" - " complex name with space = value with space \n" - "\n[sus]\n" - "nice = 1\n" - ";comment\n" - "another=10;x\n" - "true=1 ;xx\n" - " # comment 2 ;\n" - "\ntry = catch 123 bool\n" - " k e y = value pair! ; comment\n"; + /* 1*/ "ciao = 10\n" + /* 2*/ "global = yes\n" + /* 3*/ " complex name with space = value with space \n\n" + /* 5*/ "[sus]\n" + /* 6*/ "nice = 1\n" + /* 7*/ ";comment\n\n" + /* 9*/ "another=10;x\n" + /*10*/ "true=1 ;xx\n" + /*11*/ " # comment 2 ;\n\n" + /*13*/ "try = catch 123 bool\n" + /*14*/ " k e y = value pair! ; comment\n"; any_ini_t ini; any_ini_init(&ini, src, strlen(src)); - char *section = "", *key, *value; - + char *section = ""; do { - printf("SECTION: %s\n", section); + printf("%ld: SECTION \"%s\"\n", ini.line, section); + char *key, *value; while ((key = any_ini_next_key(&ini)) != NULL) { value = any_ini_next_value(&ini); - printf("PAIR: `%s` = `%s`\n", key, value); + printf("%ld: \"%s\" = \"%s\"\n", ini.line, key, value); } - } while ((section = any_ini_next_section(&ini)) != NULL); return 0; -- cgit v1.2.3