aboutsummaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-12-03 16:10:11 +0100
committerPierre Ossman <ossman@cendio.se>2025-01-10 10:13:04 +0100
commite97e225024fbf91a0f5dc78629e09fc9e56e3ba1 (patch)
treee884773d38b9a45c0b1254c7d18da2d0925c7a26 /win
parent2ce0d58ff85ecda29acfbaa6961b95439cc64ff3 (diff)
downloadtigervnc-e97e225024fbf91a0f5dc78629e09fc9e56e3ba1.tar.gz
tigervnc-e97e225024fbf91a0f5dc78629e09fc9e56e3ba1.zip
Consolidate argument parsing in single function
Avoid duplicating this complexity everywhere and make sure all commands get the same handling and fixes.
Diffstat (limited to 'win')
-rw-r--r--win/vncconfig/vncconfig.cxx13
-rw-r--r--win/winvnc/winvnc.cxx14
2 files changed, 11 insertions, 16 deletions
diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx
index fffdea18..56085bce 100644
--- a/win/vncconfig/vncconfig.cxx
+++ b/win/vncconfig/vncconfig.cxx
@@ -61,15 +61,12 @@ processParams(int argc, char* argv[]) {
} else if (strcasecmp(argv[i], "-user") == 0) {
configKey = HKEY_CURRENT_USER;
} else {
- // Try to process <option>=<value>, or -<bool>
- if (Configuration::setParam(argv[i], true))
+ int ret;
+
+ ret = Configuration::handleParamArg(argc, argv, i);
+ if (ret > 0) {
+ i += ret - 1;
continue;
- // Try to process -<option> <value>
- if ((argv[i][0] == '-') && (i+1 < argc)) {
- if (Configuration::setParam(&argv[i][1], argv[i+1], true)) {
- i++;
- continue;
- }
}
}
}
diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx
index 299e1fa1..716adacf 100644
--- a/win/winvnc/winvnc.cxx
+++ b/win/winvnc/winvnc.cxx
@@ -212,16 +212,14 @@ static void processParams(int argc, char** argv) {
break;
} else {
- // Try to process <option>=<value>, or -<bool>
- if (Configuration::setParam(argv[i], true))
+ int ret;
+
+ ret = Configuration::handleParamArg(argc, argv, i);
+ if (ret > 0) {
+ i += ret - 1;
continue;
- // Try to process -<option> <value>
- if ((argv[i][0] == '-') && (i+1 < argc)) {
- if (Configuration::setParam(&argv[i][1], argv[i+1], true)) {
- i++;
- continue;
- }
}
+
// Nope. Show them usage and don't run the server
runServer = false;
programUsage();