diff options
| author | Clecio Jung | 2023-03-23 17:10:31 -0300 |
|---|---|---|
| committer | Clecio Jung | 2023-03-23 17:10:31 -0300 |
| commit | 629d03b079b29f6d5178c407537aa15f9d109ec8 (patch) | |
| tree | 801cbdde1d0bce5181b99d0fa741f6134cd4981d /examples/ini_file_search.c | |
| parent | 308925f81dcac05471e818865a94061f3421f217 (diff) | |
| download | libini-629d03b079b29f6d5178c407537aa15f9d109ec8.tar.xz libini-629d03b079b29f6d5178c407537aa15f9d109ec8.tar.zst | |
Sorting sections and properties
Diffstat (limited to 'examples/ini_file_search.c')
| -rw-r--r-- | examples/ini_file_search.c | 7 |
1 files changed, 7 insertions, 0 deletions
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)); |
