From: Michael Tremer Date: Fri, 5 Jun 2026 14:29:40 +0000 (+0000) Subject: args: Add function to check if any sources have been added X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=c2d8f509310dbd03d7c4ce92ec0fc80ac4690c05;p=telemetry.git args: Add function to check if any sources have been added Signed-off-by: Michael Tremer --- diff --git a/src/daemon/args.c b/src/daemon/args.c index 363361a..5b5d852 100644 --- a/src/daemon/args.c +++ b/src/daemon/args.c @@ -25,6 +25,7 @@ #include "args.h" #include "ctx.h" +#include "string.h" struct td_args { td_ctx* ctx; @@ -146,3 +147,12 @@ int td_args_dump(td_args* self) { return 0; } + +int td_args_has_sources(td_args* self) { + for (int i = 0; i < self->argc; i++) { + if (td_string_startswith(self->argv[i], "DEF:")) + return 1; + } + + return 0; +} diff --git a/src/daemon/args.h b/src/daemon/args.h index 816cd43..c529397 100644 --- a/src/daemon/args.h +++ b/src/daemon/args.h @@ -40,4 +40,6 @@ int td_args_pushv(td_args* self, const char* args[]); int td_args_dump(td_args* self); +int td_args_has_sources(td_args* self); + #endif /* TELEMETRY_ARGS_H */