fixed multi receiver and frames sync help throw of bad variant access (#1266)
Some checks failed
Build on RHEL9 / build (push) Failing after 5m18s
Build on RHEL8 / build (push) Failing after 6m32s

This commit is contained in:
2025-08-12 11:40:16 +02:00
committed by GitHub
parent 6b763797df
commit 89fe2a6329
2 changed files with 40 additions and 19 deletions

View File

@@ -34,13 +34,16 @@ ParsedOptions CommandLineOptions::parse(int argc, char *argv[]) {
optind = 0; // reset getopt
int opt, option_index = 0;
bool help_or_version_requested = false;
while ((opt = getopt_long(argc, argv, optString_.c_str(),
longOptions_.data(), &option_index)) != -1) {
switch (opt) {
case 'v':
case 'h':
handleCommonOption(opt, optarg, base);
return base; // exit after version/help
help_or_version_requested = true;
break;
case 'p':
case 'u':
handleCommonOption(opt, optarg, base);
@@ -56,7 +59,7 @@ ParsedOptions CommandLineOptions::parse(int argc, char *argv[]) {
}
// remaining arguments
if (optind < argc) {
if (!help_or_version_requested && optind < argc) {
// deprecated and current options => invalid
if (base.port != DEFAULT_TCP_RX_PORTNO || multi.numReceivers != 1 ||
@@ -87,13 +90,15 @@ ParsedOptions CommandLineOptions::parse(int argc, char *argv[]) {
}
// Logging
LOG(sls::logINFO) << "TCP Port: " << base.port;
if (appType_ == AppType::MultiReceiver) {
LOG(sls::logINFO) << "Number of receivers: " << multi.numReceivers;
LOG(sls::logINFO) << "Callback enabled: " << multi.callbackEnabled;
} else if (appType_ == AppType::FrameSynchronizer) {
LOG(sls::logINFO) << "Number of receivers: " << frame.numReceivers;
LOG(sls::logINFO) << "Print headers: " << frame.printHeaders;
if (!help_or_version_requested) {
LOG(sls::logINFO) << "TCP Port: " << base.port;
if (appType_ == AppType::MultiReceiver) {
LOG(sls::logINFO) << "Number of receivers: " << multi.numReceivers;
LOG(sls::logINFO) << "Callback enabled: " << multi.callbackEnabled;
} else if (appType_ == AppType::FrameSynchronizer) {
LOG(sls::logINFO) << "Number of receivers: " << frame.numReceivers;
LOG(sls::logINFO) << "Print headers: " << frame.printHeaders;
}
}
switch (appType_) {