diff options
author | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-01-16 05:25:37 +0000 |
---|---|---|
committer | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-01-16 05:25:37 +0000 |
commit | ee577129bcb8881a58afe9d8dc87f1aed6133417 (patch) | |
tree | c2e519f37f38576e26416d8813dd8d18a98fbd6a | |
parent | 6061fbaf0e2f0df545dd5dcbad4707483c178e45 (diff) | |
download | lcd4linux-ee577129bcb8881a58afe9d8dc87f1aed6133417.tar.gz |
dump config file if verbose_level > 1
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@970 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r-- | cfg.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -673,6 +673,26 @@ static int cfg_read(const char *file) } +static void cfg_dump(void) +{ + int i, len; + + /* find longest key for pretty output */ + len = 1; + for (i = 0; i < nConfig; i++) { + int l = strlen(Config[i].key); + if (l > len) + len = l; + } + + info("Dump of %s:", Config_File); + for (i = 0; i < nConfig; i++) { + info(" %-*s %s", len, Config[i].key, Config[i].val); + } + info(""); +} + + int cfg_init(const char *file) { if (cfg_check_source(file) == -1) { @@ -684,8 +704,12 @@ int cfg_init(const char *file) if (Config_File) free(Config_File); + Config_File = strdup(file); + if (verbose_level > 1) + cfg_dump(); + return 0; } |