From 8fdc80533f59989514d9fba001f46f01cf23ec26 Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Wed, 1 May 2024 16:40:24 +0530 Subject: [PATCH] SimpCfg:Cleanup:Cmdline Arg, GetValueCallerLogging, StringCmp Bring the direct string comparison also back, as the issue with cmp was more to do with string.transform. --- common/simpcfg.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/simpcfg.hpp b/common/simpcfg.hpp index 673e62f55..4461dd1ba 100644 --- a/common/simpcfg.hpp +++ b/common/simpcfg.hpp @@ -163,7 +163,7 @@ public: return defaultValue; } auto value = gm[key]; - LDBUG_LN("DBUG:SC:%s:%s:%s:%s", __func__, group.c_str(), key.c_str(), to_str(value).c_str()); + LDBUG_LN("DBUG:SC:%s_%s:%s:%s:%s", __func__, callerName.c_str(), group.c_str(), key.c_str(), to_str(value).c_str()); return std::get(value); } @@ -229,7 +229,7 @@ public: value = str_trim(value, ","); std::string vtype = "bool"; auto valueLower = str_tolower(value); - if ((valueLower.compare("true") == 0) || (valueLower.compare("false") == 0)) { + if ((valueLower.compare("true") == 0) || (valueLower == "false")) { set_bool(group, key, value); } else if (std::regex_match(value, rInt)) { vtype = "int"; @@ -254,6 +254,10 @@ public: #ifdef SC_TEST_PRG int main(int argc, char **argv) { + if (argc != 2) { + LERRR_LN("USAGE:%s simp.cfg", argv[0]); + exit(1); + } std::string fname {argv[1]}; SimpCfg sc; sc.load(fname);