summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-12-14 16:09:54 +0100
committerMarcel Holtmann <marcel@holtmann.org>2012-12-14 16:09:54 +0100
commitb7503542f2ee9f95b3277e099fb5d0cb883c1b9e (patch)
tree8123838c179dcd242ea4b4d04f6d1cb25bd34615 /src/main.c
parenta3cadcb8be4234c53efbdab2bf87e3a6ac76b6f4 (diff)
downloadconnman-b7503542f2ee9f95b3277e099fb5d0cb883c1b9e.tar.gz
connman-b7503542f2ee9f95b3277e099fb5d0cb883c1b9e.tar.bz2
connman-b7503542f2ee9f95b3277e099fb5d0cb883c1b9e.zip
main: Small cleanup for config file parsing and checking
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 36d49c6c..350d43b3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -42,7 +42,8 @@
#define DEFAULT_INPUT_REQUEST_TIMEOUT 120 * 1000
#define DEFAULT_BROWSER_LAUNCH_TIMEOUT 300 * 1000
-#define CONFIGMAINFILE CONFIGDIR "/main.conf"
+#define MAINFILE "main.conf"
+#define CONFIGMAINFILE CONFIGDIR "/" MAINFILE
static char *default_auto_connect[] = {
"wifi",
@@ -190,7 +191,8 @@ static void check_config(GKeyFile *config)
for (j = 0; keys != NULL && keys[j] != NULL; j++) {
if (g_strcmp0(keys[j], "General") != 0)
- connman_warn("Unknown group %s in main.conf", keys[j]);
+ connman_warn("Unknown group %s in %s",
+ keys[j], MAINFILE);
}
g_strfreev(keys);
@@ -209,7 +211,8 @@ static void check_config(GKeyFile *config)
}
}
if (found == FALSE && supported_options[i] == NULL)
- connman_warn("Unknown key %s in main.conf", keys[j]);
+ connman_warn("Unknown option %s in %s",
+ keys[j], MAINFILE);
}
g_strfreev(keys);
@@ -233,9 +236,7 @@ static void parse_config(GKeyFile *config)
return;
}
- DBG("parsing main.conf");
-
- check_config(config);
+ DBG("parsing %s", MAINFILE);
boolean = g_key_file_get_boolean(config, "General",
CONF_BG_SCAN, &error);
@@ -245,7 +246,7 @@ static void parse_config(GKeyFile *config)
g_clear_error(&error);
timeservers = g_key_file_get_string_list(config, "General",
- CONF_PREF_TIMESERVERS, NULL, &error);
+ CONF_PREF_TIMESERVERS, NULL, &error);
if (error == NULL)
connman_settings.pref_timeservers = timeservers;
@@ -333,6 +334,7 @@ static int config_init(const char *file)
GKeyFile *config;
config = load_config(file);
+ check_config(config);
parse_config(config);
if (config != NULL)
g_key_file_free(config);