summaryrefslogtreecommitdiffstats
path: root/vncviewer/vncviewer.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2020-09-18 10:44:32 +0200
committerPierre Ossman <ossman@cendio.se>2020-09-18 10:44:32 +0200
commit38c6848b30cb1908171f2b4628e345fbf6727b39 (patch)
tree9865b32cbcea5e02d46200dc4f40fcea8b3b5769 /vncviewer/vncviewer.cxx
parente6f910a0ad660d38617341747f49d7bcc41b2696 (diff)
downloadtigervnc-38c6848b30cb1908171f2b4628e345fbf6727b39.tar.gz
tigervnc-38c6848b30cb1908171f2b4628e345fbf6727b39.zip
Tolerate specifying -BoolParam 0 and similar
This is needed by vncserver which doesn't know which parameters are boolean, and it cannot use the -Param=Value form as that isn't tolerated by the Xorg code.
Diffstat (limited to 'vncviewer/vncviewer.cxx')
-rw-r--r--vncviewer/vncviewer.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index d4dd3063..77ba3d3f 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -556,6 +556,26 @@ int main(int argc, char** argv)
}
for (int i = 1; i < argc;) {
+ /* We need to resolve an ambiguity for booleans */
+ if (argv[i][0] == '-' && i+1 < argc) {
+ VoidParameter *param;
+
+ param = Configuration::getParam(&argv[i][1]);
+ if ((param != NULL) &&
+ (dynamic_cast<BoolParameter*>(param) != NULL)) {
+ if ((strcasecmp(argv[i+1], "0") == 0) ||
+ (strcasecmp(argv[i+1], "1") == 0) ||
+ (strcasecmp(argv[i+1], "true") == 0) ||
+ (strcasecmp(argv[i+1], "false") == 0) ||
+ (strcasecmp(argv[i+1], "yes") == 0) ||
+ (strcasecmp(argv[i+1], "no") == 0)) {
+ param->setParam(argv[i+1]);
+ i += 2;
+ continue;
+ }
+ }
+ }
+
if (Configuration::setParam(argv[i])) {
i++;
continue;