From d3eb5f8342af3d8aea6b40737fbd441b4117635b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Wed, 8 May 2024 19:10:27 +0200 Subject: [PATCH] Add minimal mode --- cli_parser.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cli_parser.cpp b/cli_parser.cpp index d9ed1d0..7caf44d 100644 --- a/cli_parser.cpp +++ b/cli_parser.cpp @@ -11,12 +11,14 @@ void config::parseCommandLine(int argc, char *argv[]) { {"vport", required_argument, nullptr, 'b'}, {"version", required_argument, nullptr, 'r'}, {"state", required_argument, nullptr, 's'}, + {"minimal", no_argument, nullptr, 'm'}, {"help", no_argument, nullptr, 0}, {nullptr, 0, nullptr, 0} }; int opt; - while ((opt = getopt_long(argc, argv, "h:p:v:b:r:s:", longOptions, nullptr)) != -1) { + bool minimal = false; + while ((opt = getopt_long(argc, argv, "h:p:v:b:r:s:m:", longOptions, nullptr)) != -1) { switch (opt) { case 'h': hostname = optarg; @@ -36,6 +38,13 @@ void config::parseCommandLine(int argc, char *argv[]) { case 's': nextState = std::stoi(optarg); break; + case 'm': + nextState = 1; + protocolVersion = -1; + virtualPort = 0; + virtualHostname = ""; + minimal = true; + break; case 0: // --help printHelp(); exit(0); @@ -51,7 +60,7 @@ void config::parseCommandLine(int argc, char *argv[]) { exit(1); } - if (virtualHostname.empty()) { + if (virtualHostname.empty() && !minimal) { virtualHostname = hostname; // Default to real hostname } }