diff --git a/slsReceiverSoftware/src/CommandLineOptions.cpp b/slsReceiverSoftware/src/CommandLineOptions.cpp index ec682f395..a7d91f8cb 100644 --- a/slsReceiverSoftware/src/CommandLineOptions.cpp +++ b/slsReceiverSoftware/src/CommandLineOptions.cpp @@ -9,263 +9,302 @@ #include #include -#include #include -#define MAX_RECEIVERS 1024 - -ParsedOptions parseCommandLine(AppType app, int argc, char* argv[]) { +ParsedOptions CommandLineOptions::parse(int argc, char *argv[]) { CommonOptions base; base.port = DEFAULT_TCP_RX_PORTNO; + MultiReceiverOptions multi; FrameSyncOptions frame; + uint16_t numReceivers = 1; bool optionalArg = false; + auto optString = buildOptString(); + auto longOptions = buildOptionList(); + int opt; int option_index = 0; - static struct option common_opts[] = { - {"version", no_argument, nullptr, 'v'}, - {"port", required_argument, nullptr, 'p'}, - {"uid", required_argument, nullptr, 'u'}, - {"help", no_argument, nullptr, 'h'}, - {nullptr, 0, nullptr, 0} - }; - - static struct option single_opts[] = { - {"rx_tcpport", required_argument, nullptr, 't'}, - {nullptr, 0, nullptr, 0} - }; - - static struct option multi_opts[] = { - {"callback", no_argument, nullptr, 'c'}, - {"rx_tcpport", required_argument, nullptr, 't'}, - {"num-receivers", required_argument, nullptr, 'n'}, - {nullptr, 0, nullptr, 0} - }; - - static struct option frame_sync_opts[] = { - {"print-headers", no_argument, nullptr, 'c'}, - {"num-receivers", required_argument, nullptr, 'n'}, - {nullptr, 0, nullptr, 0} - }; - - std::vector