Moved configuration handling into cli handler code
Cleanup: moved the updating of configuration object to
command line handling code to remove some single-use booleans.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I503e72c07b35a1537d93241a26a92f87854ba105
diff --git a/listener.cpp b/listener.cpp
index c8ae642..e0640aa 100644
--- a/listener.cpp
+++ b/listener.cpp
@@ -39,10 +39,6 @@
{
using namespace boost::interprocess;
- // convert thread params to main arguments
- int argc = static_cast<MainArgs_t*>(i_params)->argc;
- char** argv = static_cast<MainArgs_t*>(i_params)->argv;
-
// vector to hold messages sent to listener
std::vector<std::string> messages;
@@ -55,19 +51,8 @@
// status of gpio monitor
bool gpioMonEnabled = false;
- // Parse command line args to see if any flags were passed, update the
- // booleans accordingly and pass them to the config object constructor.
- bool vital_enable = true;
- bool checkstop_enable = true;
- bool ti_enable = true;
- bool bp_enable = true;
-
- // parse config options
- parseConfig(argv, argv + argc, vital_enable, checkstop_enable, ti_enable,
- bp_enable);
-
// create config
- attn::Config config(vital_enable, checkstop_enable, ti_enable, bp_enable);
+ attn::Config attnConfig;
// initialize pdbg targets
pdbg_targets_init(nullptr);
@@ -124,12 +109,7 @@
}
// parse config options
- parseConfig(argv.data(), argv.data() + argc, vital_enable,
- checkstop_enable, ti_enable, bp_enable);
-
- // set config
- config.setConfig(vital_enable, checkstop_enable, ti_enable,
- bp_enable);
+ parseConfig(argv.data(), argv.data() + argc, &attnConfig);
// start attention handler daemon?
if (true ==
@@ -138,7 +118,7 @@
if (false == gpioMonEnabled)
{
if (0 == pthread_create(&ptidGpio, NULL, &threadGpioMon,
- &config))
+ &attnConfig))
{
gpioMonEnabled = true;
}