From 629d03b079b29f6d5178c407537aa15f9d109ec8 Mon Sep 17 00:00:00 2001 From: Clecio Jung Date: Thu, 23 Mar 2023 17:10:31 -0300 Subject: Sorting sections and properties --- examples/ini_file_search.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'examples/ini_file_search.c') diff --git a/examples/ini_file_search.c b/examples/ini_file_search.c index 43d3ccc..b36a9dc 100644 --- a/examples/ini_file_search.c +++ b/examples/ini_file_search.c @@ -32,6 +32,13 @@ int main(const int argc, const char **const argv) { ini_file_print_to(ini_file, stdout); break; case 3: + /* First, try to find this name as a property in the global section */ + error = ini_file_find_property(ini_file, NULL, argv[2], &value); + if (error == ini_no_error) { + puts(value); + break; + } + /* If it wasn't a property, try to fnd it as a section */ error = ini_file_find_section(ini_file, argv[2], &ini_section); if (error != ini_no_error) { fprintf(stderr, "%s\n", ini_file_error_to_string(error)); -- cgit v1.2.3