From d91d02619d4c1330b871a5418e436b2f81db533a Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 27 Nov 2025 23:42:56 +0100 Subject: check_dig: Move flag parsing to parameter processing and out of main The processing of the forbid-flags and the require-flags parameter was done in the main function previous to this. Since no further information is actually needed during runtime, I moved the processing in the cli param processing stage to reduce actual complexity later. --- plugins/check_dig.d/config.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'plugins/check_dig.d/config.h') diff --git a/plugins/check_dig.d/config.h b/plugins/check_dig.d/config.h index 392848e5..dd1f58b5 100644 --- a/plugins/check_dig.d/config.h +++ b/plugins/check_dig.d/config.h @@ -7,6 +7,11 @@ #define DEFAULT_PORT 53 #define DEFAULT_TRIES 2 +typedef struct { + char **items; + size_t count; +} flag_list; + typedef struct { char *query_address; char *record_type; @@ -19,8 +24,8 @@ typedef struct { double warning_interval; double critical_interval; - char *require_flags; - char *forbid_flags; + flag_list require_flags; + flag_list forbid_flags; } check_dig_config; check_dig_config check_dig_config_init() { @@ -36,9 +41,8 @@ check_dig_config check_dig_config_init() { .warning_interval = UNDEFINED, .critical_interval = UNDEFINED, - .require_flags = NULL, - .forbid_flags = NULL, - + .require_flags = {.count = 0, .items = NULL}, + .forbid_flags = {.count = 0, .items = NULL}, }; return tmp; } -- cgit v1.2.3-74-g34f1