diff options
author | Alok Barsode <alok.barsode@linux.intel.com> | 2012-04-05 13:20:23 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-04-05 18:56:43 +0300 |
commit | fb84de7beb2e06da5e267d397a4f350a2af867d3 (patch) | |
tree | 7cf572c19e0f1f97c229e24474ca3c69a5563e3f /src/main.c | |
parent | de943a88d1933a12586948d0afbd908556ab3e9e (diff) | |
download | connman-fb84de7beb2e06da5e267d397a4f350a2af867d3.tar.gz connman-fb84de7beb2e06da5e267d397a4f350a2af867d3.tar.bz2 connman-fb84de7beb2e06da5e267d397a4f350a2af867d3.zip |
main: Parse FallbackTimeservers list from main.conf
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -44,8 +44,10 @@ static struct { connman_bool_t bg_scan; + char **pref_timeservers; } connman_settings = { .bg_scan = TRUE, + .pref_timeservers = NULL, }; static GKeyFile *load_config(const char *file) @@ -75,6 +77,7 @@ static void parse_config(GKeyFile *config) { GError *error = NULL; gboolean boolean; + char **timeservers; if (config == NULL) return; @@ -87,6 +90,13 @@ static void parse_config(GKeyFile *config) connman_settings.bg_scan = boolean; g_clear_error(&error); + + timeservers = g_key_file_get_string_list(config, "General", + "FallbackTimeservers", NULL, &error); + if (error == NULL) + connman_settings.pref_timeservers = timeservers; + + g_clear_error(&error); } static GMainLoop *main_loop = NULL; @@ -237,6 +247,14 @@ connman_bool_t connman_setting_get_bool(const char *key) return FALSE; } +char **connman_setting_get_string_list(const char *key) +{ + if (g_str_equal(key, "FallbackTimeservers") == TRUE) + return connman_settings.pref_timeservers; + + return NULL; +} + int main(int argc, char *argv[]) { GOptionContext *context; @@ -419,6 +437,9 @@ int main(int argc, char *argv[]) if (config) g_key_file_free(config); + if (connman_settings.pref_timeservers != NULL) + g_strfreev(connman_settings.pref_timeservers); + g_free(option_debug); return 0; |