Add minimal mode

This commit is contained in:
Bruno Rybársky 2024-05-08 19:10:27 +02:00
parent bd81347c83
commit d3eb5f8342

@ -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
}
}