mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2024-11-21 23:53:24 +01:00
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.
This commit is contained in:
parent
3528e358cc
commit
45e44a66e5
@ -143,6 +143,22 @@ const char* vncGetParamDesc(const char *name)
|
||||
return param->getDescription();
|
||||
}
|
||||
|
||||
int vncIsParamBool(const char *name)
|
||||
{
|
||||
VoidParameter *param;
|
||||
BoolParameter *bparam;
|
||||
|
||||
param = rfb::Configuration::getParam(name);
|
||||
if (param == NULL)
|
||||
return false;
|
||||
|
||||
bparam = dynamic_cast<BoolParameter*>(param);
|
||||
if (bparam == NULL)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int vncGetParamCount(void)
|
||||
{
|
||||
int count;
|
||||
|
@ -41,6 +41,7 @@ int vncSetParam(const char *name, const char *value);
|
||||
int vncSetParamSimple(const char *nameAndValue);
|
||||
char* vncGetParam(const char *name);
|
||||
const char* vncGetParamDesc(const char *name);
|
||||
int vncIsParamBool(const char *name);
|
||||
|
||||
int vncGetParamCount(void);
|
||||
char *vncGetParamList(void);
|
||||
|
@ -639,6 +639,20 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* We need to resolve an ambiguity for booleans */
|
||||
if (argv[i][0] == '-' && i+1 < argc &&
|
||||
vncIsParamBool(&argv[i][1])) {
|
||||
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)) {
|
||||
vncSetParam(&argv[i][1], argv[i+1]);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (vncSetParamSimple(argv[i]))
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user