From 19e0f08e2b2defec25f65f65d73de9cdc7844138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Ratkevi=C4=8Dius?= Date: Tue, 14 May 2019 15:23:54 +0300 Subject: Implemented enumerator for verbosity levels. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Solves ticket #30 Signed-off-by: Paulius Ratkevičius --- include/settings.h | 8 ++++++++ src/daemon/settings.c | 4 ++-- src/daemon/settings_private.h | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/settings.h b/include/settings.h index 72addd0..16d3a7a 100644 --- a/include/settings.h +++ b/include/settings.h @@ -22,6 +22,14 @@ #ifndef USURPATION_SETTINGS_H #define USURPATION_SETTINGS_H +enum verbosity { + SILENT = 0, + DEBUG = 2, + WARN = 2, + ERR = 2, + ALL = 3 +}; + void settings_init(void); int setting_detach(void); unsigned short int setting_port(void); diff --git a/src/daemon/settings.c b/src/daemon/settings.c index bac1c3b..4392300 100644 --- a/src/daemon/settings.c +++ b/src/daemon/settings.c @@ -30,7 +30,7 @@ void settings_init(void) { unset_flag(flag_daemonize); settings.port = 6996; - settings.verbosity = USURP_VERBOSITY; + settings.verboselevel = USURP_VERBOSITY; } int setting_detach(void) @@ -40,7 +40,7 @@ int setting_detach(void) int setting_verbose(void) { - return settings.verbosity; + return settings.verboselevel; } unsigned short int setting_port(void) diff --git a/src/daemon/settings_private.h b/src/daemon/settings_private.h index 7839cb9..133cf51 100644 --- a/src/daemon/settings_private.h +++ b/src/daemon/settings_private.h @@ -31,7 +31,7 @@ static const unsigned int flag_daemonize = 1 << 0; /* 1st bit */ static struct settings { unsigned int flags; unsigned short int port; - int verbosity; + enum verbosity verboselevel; } settings; int test_flag(unsigned int flag); -- cgit v1.2.3 From 8928d3f345458705611c20ac5315c849369e0142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Ratkevi=C4=8Dius?= Date: Tue, 14 May 2019 15:30:35 +0300 Subject: Fixed some small issues with enumerator. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Solves ticket #30 Signed-off-by: Paulius Ratkevičius --- include/settings.h | 8 ++++---- src/daemon/settings_private.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/settings.h b/include/settings.h index 16d3a7a..68360c0 100644 --- a/include/settings.h +++ b/include/settings.h @@ -24,10 +24,10 @@ enum verbosity { SILENT = 0, - DEBUG = 2, - WARN = 2, - ERR = 2, - ALL = 3 + ERR = 1, + WARN, + DEBUG, + ALL }; void settings_init(void); diff --git a/src/daemon/settings_private.h b/src/daemon/settings_private.h index 133cf51..ee49145 100644 --- a/src/daemon/settings_private.h +++ b/src/daemon/settings_private.h @@ -23,7 +23,7 @@ #define USURPATION_SETTINGS_PRIVATE_H #ifndef USURP_VERBOSITY - #define USURP_VERBOSITY 1 + #define USURP_VERBOSITY ERR #endif static const unsigned int flag_daemonize = 1 << 0; /* 1st bit */ -- cgit v1.2.3