From 86b14eb4e0473360cd35163dfe2366f5c91384b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Ratkevi=C4=8Dius?= Date: Fri, 17 May 2019 15:29:11 +0300 Subject: daemon: semi-stub for config file handling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The daemon now load and somewhat parses the config files. It does not do anything else with the data yet, that's a TODO. Signed-off-by: Paulius Ratkevičius --- src/daemon/settings_private.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/daemon/settings_private.h') diff --git a/src/daemon/settings_private.h b/src/daemon/settings_private.h index ee49145..42c1fa5 100644 --- a/src/daemon/settings_private.h +++ b/src/daemon/settings_private.h @@ -37,5 +37,7 @@ static struct settings { int test_flag(unsigned int flag); void set_flag(unsigned int flag); void unset_flag(unsigned int flag); +static int setting_readconf(const char * const path); +static int setting_handle_config_entry(const char * const entry, const char * const value); #endif /* USURPATION_SETTINGS_PRIVATE_H */ -- cgit v1.2.3 From bd427117a36715cc602e85869cd7d6db6415a945 Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Sun, 19 May 2019 16:15:11 +0300 Subject: daemon: handle the daemonize flag now. The flag is now successfully read from the config file and is honored. Logic does not handle leading or trailing whitespace yet. Signed-off-by: Gediminas Jakutis --- src/daemon/settings_private.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/daemon/settings_private.h') diff --git a/src/daemon/settings_private.h b/src/daemon/settings_private.h index 42c1fa5..2d97bdd 100644 --- a/src/daemon/settings_private.h +++ b/src/daemon/settings_private.h @@ -34,10 +34,24 @@ static struct settings { enum verbosity verboselevel; } settings; +struct entry_description { + const char * const name; + void (*set)(const void * const); +}; + + int test_flag(unsigned int flag); void set_flag(unsigned int flag); void unset_flag(unsigned int flag); static int setting_readconf(const char * const path); static int setting_handle_config_entry(const char * const entry, const char * const value); +static void set_daemonize(const void * const arg); +static void set_port(const void * const arg); +static void set_verbosity(const void * const arg); + +struct entry_description ent_table[] = {{ "daemonize", set_daemonize }, + { "port", set_port }, + { "verbosity", set_verbosity }}; + #endif /* USURPATION_SETTINGS_PRIVATE_H */ -- cgit v1.2.3