aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-01-16 05:25:37 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-01-16 05:25:37 +0000
commitee577129bcb8881a58afe9d8dc87f1aed6133417 (patch)
treec2e519f37f38576e26416d8813dd8d18a98fbd6a
parent6061fbaf0e2f0df545dd5dcbad4707483c178e45 (diff)
downloadlcd4linux-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.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/cfg.c b/cfg.c
index 832b196..2ed3844 100644
--- a/cfg.c
+++ b/cfg.c
@@ -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;
}