aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Args.c
diff options
context:
space:
mode:
authorMihai Moldovan <ïonic@ionic.de>2016-07-02 21:49:10 +0000
committerMihai Moldovan <ïonic@ionic.de>2016-07-28 03:26:00 +0000
commit29be5cc07bdaa22086da6d0607a1c86b07e95875 (patch)
treec2530836677a775dc921bb82f78b986ba5216458 /nx-X11/programs/Xserver/hw/nxagent/Args.c
parente1c85caacca67ea3d25319f2fe0a2985845bf1e9 (diff)
downloadnx-libs-29be5cc07bdaa22086da6d0607a1c86b07e95875.tar.gz
nx-libs-29be5cc07bdaa22086da6d0607a1c86b07e95875.tar.bz2
nx-libs-29be5cc07bdaa22086da6d0607a1c86b07e95875.zip
{nx-X11/programs/Xserver/hw/nxagent/{Args.c,Options.{c,h}},nxcomp/{Loop,Misc}.cpp}: add tolerancechecks parameter as an nx/nx option and ReconnectTolerance as an nxagentOption.
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Args.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index 832595786..9e54c0073 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -1405,6 +1405,82 @@ static void nxagentParseOptions(char *name, char *value)
return;
}
+ else if (!strcmp(name, "tolerancechecks"))
+ {
+ if (strcmp(value, "strict") == 0)
+ {
+ nxagentChangeOption(ReconnectTolerance, ToleranceChecksStrict);
+ }
+ else if (strcmp(value, "safe") == 0)
+ {
+ nxagentChangeOption(ReconnectTolerance, ToleranceChecksSafe);
+ }
+ else if (strcmp(value, "risky") == 0)
+ {
+ nxagentChangeOption(ReconnectTolerance, ToleranceChecksRisky);
+ }
+ else if (strcmp(value, "none") == 0)
+ {
+ nxagentChangeOption(ReconnectTolerance, ToleranceChecksBypass);
+ }
+ else
+ {
+ /*
+ * Check for a matching integer. Or any integer, really.
+ */
+ long tolerance_parse = 0;
+
+ errno = 0;
+ tolerance_parse = strtol(value, NULL, 10);
+
+ if ((errno) && (0 == tolerance_parse))
+ {
+ fprintf(stderr, "nxagentParseOptions: Unable to convert value [%s] of option [%s]. "
+ "Ignoring option.\n",
+ validateString(value), validateString(name));
+
+ return;
+ }
+
+ if ((long) UINT_MAX < tolerance_parse)
+ {
+ tolerance_parse = UINT_MAX;
+
+ fprintf(stderr, "nxagentParseOptions: Warning: value [%s] of option [%s] "
+ "out of range, clamped to [%u].\n",
+ validateString(value), validateString(name), tolerance_parse);
+ }
+
+ if (0 > tolerance_parse)
+ {
+ tolerance_parse = 0;
+
+ fprintf(stderr, "nxagentParseOptions: Warning: value [%s] of option [%s] "
+ "out of range, clamped to [%u].\n",
+ validateString(value), validateString(name), tolerance_parse);
+ }
+
+ #ifdef TEST
+ switch (tolerance_parse) {
+ case ToleranceChecksStrict:
+ case ToleranceChecksSafe:
+ case ToleranceChecksRisky:
+ case ToleranceChecksBypass:
+ break;
+ default:
+ fprintf(stderr, "nxagentParseOptions: Warning: value [%s] of "
+ "option [%s] unknown, will be mapped to "
+ "\"Bypass\" [%u] value internally.\n",
+ validateString(value), validateString(name),
+ (unsigned int)ToleranceChecksBypass);
+ }
+ #endif
+
+ nxagentChangeOption(ReconnectTolerance, tolerance_parse);
+ }
+
+ return;
+ }
else
{
#ifdef DEBUG