From ec3cfc1138037aa9d1d6af8e9370b0acd60c619d Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 21 Mar 2025 10:24:24 +0100 Subject: [PATCH] some checks for old command line style --- slsReceiverSoftware/src/FrameSynchronizerApp.cpp | 9 ++++++++- slsReceiverSoftware/src/MultiReceiverApp.cpp | 14 +++++++++----- slsReceiverSoftware/src/ReceiverApp.cpp | 9 ++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/slsReceiverSoftware/src/FrameSynchronizerApp.cpp b/slsReceiverSoftware/src/FrameSynchronizerApp.cpp index d4020a05d..9950cbdd3 100644 --- a/slsReceiverSoftware/src/FrameSynchronizerApp.cpp +++ b/slsReceiverSoftware/src/FrameSynchronizerApp.cpp @@ -565,10 +565,17 @@ int main(int argc, char *argv[]) { case 'h': std::cout << help_message << std::endl; exit(EXIT_SUCCESS); + default: - throw sls::RuntimeError(help_message); + LOG(sls::logERROR) << help_message; + exit(EXIT_FAILURE); } } + // remaining arguments + if (optind < argc) { + LOG(sls::logERROR) << "Invalid arguments\n" << help_message; + exit(EXIT_FAILURE); + } LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << ']'; LOG(sls::logINFO) << "Number of Receivers: " << numReceivers; diff --git a/slsReceiverSoftware/src/MultiReceiverApp.cpp b/slsReceiverSoftware/src/MultiReceiverApp.cpp index 73ba6dd62..954f1235e 100644 --- a/slsReceiverSoftware/src/MultiReceiverApp.cpp +++ b/slsReceiverSoftware/src/MultiReceiverApp.cpp @@ -263,14 +263,18 @@ int main(int argc, char *argv[]) { case 'h': std::cout << help_message << std::endl; exit(EXIT_SUCCESS); + default: - // maintain backward compatibility of [startport] [num-receivers] - // [callback] - GetDeprecatedCommandLineOptions(argc, argv, startPort, numReceivers, - callbackEnabled); - throw sls::RuntimeError(help_message); + LOG(sls::logERROR) << help_message; + exit(EXIT_FAILURE); } } + // if remaining arguments, maintain backward compatibility of [startport] + // [num-receivers] [callback] + if (optind < argc) { + GetDeprecatedCommandLineOptions(argc, argv, startPort, numReceivers, + callbackEnabled); + } LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << ']'; LOG(sls::logINFO) << "Number of Receivers: " << numReceivers; diff --git a/slsReceiverSoftware/src/ReceiverApp.cpp b/slsReceiverSoftware/src/ReceiverApp.cpp index f89bcf78b..bc3b99ef3 100644 --- a/slsReceiverSoftware/src/ReceiverApp.cpp +++ b/slsReceiverSoftware/src/ReceiverApp.cpp @@ -79,10 +79,17 @@ int main(int argc, char *argv[]) { case 'h': std::cout << help_message << std::endl; exit(EXIT_SUCCESS); + default: - throw sls::RuntimeError(help_message); + LOG(sls::logERROR) << help_message; + exit(EXIT_FAILURE); } } + // remaining arguments + if (optind < argc) { + LOG(sls::logERROR) << "Invalid arguments\n" << help_message; + exit(EXIT_FAILURE); + } LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << " ]"; LOG(sls::logINFO) << "Port: " << port;