Add minimal mode
This commit is contained in:
parent
bd81347c83
commit
d3eb5f8342
@ -11,12 +11,14 @@ void config::parseCommandLine(int argc, char *argv[]) {
|
|||||||
{"vport", required_argument, nullptr, 'b'},
|
{"vport", required_argument, nullptr, 'b'},
|
||||||
{"version", required_argument, nullptr, 'r'},
|
{"version", required_argument, nullptr, 'r'},
|
||||||
{"state", required_argument, nullptr, 's'},
|
{"state", required_argument, nullptr, 's'},
|
||||||
|
{"minimal", no_argument, nullptr, 'm'},
|
||||||
{"help", no_argument, nullptr, 0},
|
{"help", no_argument, nullptr, 0},
|
||||||
{nullptr, 0, nullptr, 0}
|
{nullptr, 0, nullptr, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
int opt;
|
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) {
|
switch (opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
hostname = optarg;
|
hostname = optarg;
|
||||||
@ -36,6 +38,13 @@ void config::parseCommandLine(int argc, char *argv[]) {
|
|||||||
case 's':
|
case 's':
|
||||||
nextState = std::stoi(optarg);
|
nextState = std::stoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
nextState = 1;
|
||||||
|
protocolVersion = -1;
|
||||||
|
virtualPort = 0;
|
||||||
|
virtualHostname = "";
|
||||||
|
minimal = true;
|
||||||
|
break;
|
||||||
case 0: // --help
|
case 0: // --help
|
||||||
printHelp();
|
printHelp();
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -51,7 +60,7 @@ void config::parseCommandLine(int argc, char *argv[]) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virtualHostname.empty()) {
|
if (virtualHostname.empty() && !minimal) {
|
||||||
virtualHostname = hostname; // Default to real hostname
|
virtualHostname = hostname; // Default to real hostname
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user