Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
db74c07e
Unverified
Commit
db74c07e
authored
Nov 15, 2019
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uli42-pr/args_fixes' into 3.6.x
Attributes GH PR #857:
https://github.com/ArcticaProject/nx-libs/pull/857
parents
1ae0ceb7
6ef35a94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
140 additions
and
400 deletions
+140
-400
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+140
-400
No files found.
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
db74c07e
...
...
@@ -216,28 +216,25 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if
(
resetOptions
==
True
)
{
char
*
envOptions
=
NULL
;
char
*
envDisplay
=
NULL
;
int
j
;
nxagentInitOptions
();
resetOptions
=
False
;
/*
* Ensure the correct order of options evaluation:
* the environment first, then those included in
* the options file and, last, the command line
* options.
* Ensure the correct order of options evaluation: the environment
* first, then those included in the options file and, last, the
* command line options.
*/
envDisplay
=
getenv
(
"DISPLAY"
);
char
*
envDisplay
=
getenv
(
"DISPLAY"
);
if
(
envDisplay
!=
NULL
&&
strlen
(
envDisplay
)
==
0
)
{
envDisplay
=
NULL
;
}
for
(
j
=
0
;
j
<
argc
;
j
++
)
for
(
int
j
=
0
;
j
<
argc
;
j
++
)
{
if
((
!
strcmp
(
argv
[
j
],
"-display"
))
&&
(
j
+
1
<
argc
))
{
...
...
@@ -273,36 +270,22 @@ int ddxProcessArgument(int argc, char *argv[], int i)
SAFE_free
(
envOptions
);
}
for
(
j
=
0
;
j
<
argc
;
j
++
)
for
(
int
j
=
0
;
j
<
argc
;
j
++
)
{
if
((
!
strcmp
(
argv
[
j
],
"-options"
)
||
!
strcmp
(
argv
[
j
],
"-option"
))
&&
j
+
1
<
argc
)
{
if
(
nxagentOptionsFilenameOrString
)
{
nxagentOptionsFilenameOrString
=
(
char
*
)
realloc
(
nxagentOptionsFilenameOrString
,
strlen
(
argv
[
j
+
1
])
+
1
);
}
else
{
nxagentOptionsFilenameOrString
=
(
char
*
)
malloc
(
strlen
(
argv
[
j
+
1
])
+
1
);
}
SAFE_free
(
nxagentOptionsFilenameOrString
);
if
(
nxagentOptionsFilenameOrString
!=
NULL
)
{
nxagentOptionsFilenameOrString
=
strcpy
(
nxagentOptionsFilenameOrString
,
argv
[
j
+
1
]);
}
#ifdef WARNING
else
if
(
-
1
==
asprintf
(
&
nxagentOptionsFilenameOrString
,
"%s"
,
argv
[
j
+
1
]))
{
fprintf
(
stderr
,
"ddxProcessArgument: WARNING! failed string allocation.
\n
"
);
FatalError
(
"malloc failed
"
);
}
#endif
break
;
}
}
nxagentProcessOptions
(
nxagentOptionsFilenameOrString
);
}
}
/* if (resetOptions == True) */
if
(
!
strcmp
(
argv
[
i
],
"-B"
))
{
...
...
@@ -313,9 +296,8 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if
(
nxagentCheckBinder
(
argc
,
argv
,
i
)
>
0
)
{
/*
* We are going to run the agent with the
* 'binder' option. Go straight to the
* proxy loop.
* We are going to run the agent with the 'binder' option. Go
* straight to the proxy loop.
*/
#ifdef TEST
...
...
@@ -347,7 +329,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
snprintf
(
nxagentDisplayName
,
NXAGENTDISPLAYNAMELENGTH
,
"%s"
,
argv
[
i
]);
return
2
;
}
return
0
;
}
...
...
@@ -358,7 +339,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
snprintf
(
nxagentSessionId
,
NXAGENTSESSIONIDLENGTH
,
"%s"
,
argv
[
i
]);
return
2
;
}
return
0
;
}
...
...
@@ -386,7 +366,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
return
2
;
}
return
0
;
}
...
...
@@ -455,7 +434,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if
(
++
i
<
argc
&&
sscanf
(
argv
[
i
],
"%i"
,
&
nxagentDefaultClass
)
==
1
)
{
if
(
nxagentDefaultClass
>=
0
&&
nxagentDefaultClass
<=
5
)
{
nxagentUserDefaultClass
=
True
;
/* le
x
the OS layer process it as well, so return 0 */
/* le
t
the OS layer process it as well, so return 0 */
}
}
return
0
;
...
...
@@ -472,9 +451,8 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
/*
* These options are now useless and are
* parsed only for compatibility with
* older versions.
* These options are now useless and are parsed only for
* compatibility with older versions.
*/
if
(
!
strcmp
(
argv
[
i
],
"-fast"
)
||
...
...
@@ -484,7 +462,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
fprintf
(
stderr
,
"Warning: Ignoring deprecated command line option '%s'.
\n
"
,
argv
[
i
]);
return
1
;
}
...
...
@@ -500,10 +477,8 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
BackingStore
,
BackingStoreForce
);
}
return
2
;
}
return
0
;
}
...
...
@@ -519,10 +494,8 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
Streaming
,
1
);
}
return
2
;
}
return
0
;
}
...
...
@@ -539,17 +512,13 @@ int ddxProcessArgument(int argc, char *argv[], int i)
nxagentChangeOption
(
DeferLevel
,
level
);
/*
* The defer level set with the command
* line is not changed when the session
* is resumed.
* The defer level set with the command line is not changed
* when the session is resumed.
*/
nxagentLockDeferLevel
=
1
;
}
return
2
;
}
return
0
;
}
...
...
@@ -561,18 +530,14 @@ int ddxProcessArgument(int argc, char *argv[], int i)
sscanf
(
argv
[
i
],
"%i"
,
&
limit
)
==
1
)
{
nxagentChangeOption
(
ImageRateLimit
,
limit
);
return
2
;
}
return
0
;
}
if
(
!
strcmp
(
argv
[
i
],
"-tile"
))
{
int
width
;
int
height
;
int
width
,
height
;
if
(
++
i
<
argc
&&
sscanf
(
argv
[
i
],
"%ix%i"
,
&
width
,
&
height
)
==
2
&&
...
...
@@ -580,10 +545,8 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
TileWidth
,
width
);
nxagentChangeOption
(
TileHeight
,
height
);
return
2
;
}
return
0
;
}
...
...
@@ -591,13 +554,11 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
if
(
++
i
<
argc
)
{
#ifdef TEST
fprintf
(
stderr
,
"ddxProcessArgument: User defined font path [%s].
\n
"
,
argv
[
i
]);
#endif
nxagentUserDefinedFontPath
=
1
;
defaultFontPath
=
argv
[
i
];
}
else
...
...
@@ -628,28 +589,28 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
}
if
(
nxagentUserGeometry
.
flag
||
(
nxagentOption
(
Fullscreen
)
==
1
))
return
2
;
if
(
nxagentUserGeometry
.
flag
||
(
nxagentOption
(
Fullscreen
)
==
1
))
{
return
2
;
}
}
return
0
;
}
if
(
!
strcmp
(
argv
[
i
],
"-bw"
))
{
int
BorderWidth
;
int
bw
;
if
(
++
i
<
argc
&&
sscanf
(
argv
[
i
],
"%i"
,
&
BorderWidth
)
==
1
)
if
(
++
i
<
argc
&&
sscanf
(
argv
[
i
],
"%i"
,
&
bw
)
==
1
)
{
nxagentChangeOption
(
BorderWidth
,
BorderWidth
);
nxagentChangeOption
(
BorderWidth
,
bw
);
if
(
nxagentOption
(
BorderWidth
)
>=
0
)
if
(
bw
>=
0
)
{
nxagentUserBorderWidth
=
True
;
return
2
;
}
}
return
0
;
}
...
...
@@ -660,14 +621,17 @@ int ddxProcessArgument(int argc, char *argv[], int i)
snprintf
(
nxagentWindowName
,
NXAGENTWINDOWNAMELENGTH
,
"%s"
,
argv
[
i
]);
return
2
;
}
return
0
;
}
if
(
!
strcmp
(
argv
[
i
],
"-scrns"
))
{
if
(
++
i
<
argc
&&
sscanf
(
argv
[
i
],
"%i"
,
&
nxagentNumScreens
)
==
1
)
{
if
(
nxagentNumScreens
>
0
)
{
if
(
nxagentNumScreens
>
MAXSCREENS
)
{
if
(
!
strcmp
(
argv
[
i
],
"-scrns"
))
{
if
(
++
i
<
argc
&&
sscanf
(
argv
[
i
],
"%i"
,
&
nxagentNumScreens
)
==
1
)
{
if
(
nxagentNumScreens
>
0
)
{
if
(
nxagentNumScreens
>
MAXSCREENS
)
{
ErrorF
(
"Maximum number of screens is %d.
\n
"
,
MAXSCREENS
);
nxagentNumScreens
=
MAXSCREENS
;
}
...
...
@@ -677,37 +641,43 @@ int ddxProcessArgument(int argc, char *argv[], int i)
return
0
;
}
if
(
!
strcmp
(
argv
[
i
],
"-install"
))
{
if
(
!
strcmp
(
argv
[
i
],
"-install"
))
{
nxagentDoDirectColormaps
=
True
;
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-parent"
))
{
if
(
++
i
<
argc
)
{
if
(
!
strcmp
(
argv
[
i
],
"-parent"
))
{
if
(
++
i
<
argc
)
{
nxagentParentWindow
=
(
XID
)
strtol
(
argv
[
i
],
(
char
**
)
NULL
,
0
);
return
2
;
}
}
if
(
!
strcmp
(
argv
[
i
],
"-forcenx"
))
{
if
(
!
strcmp
(
argv
[
i
],
"-forcenx"
))
{
nxagentForceNXTrans
=
True
;
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-norootlessexit"
))
{
if
(
!
strcmp
(
argv
[
i
],
"-norootlessexit"
))
{
nxagentChangeOption
(
NoRootlessExit
,
True
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-nomagicpixel"
))
{
if
(
!
strcmp
(
argv
[
i
],
"-nomagicpixel"
))
{
nxagentChangeOption
(
MagicPixel
,
0
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-noonce"
))
{
nxagentOnce
=
False
;
return
1
;
nxagentOnce
=
False
;
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-kbtype"
)
||
...
...
@@ -722,23 +692,20 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
FatalError
(
"malloc failed"
);
}
return
2
;
}
return
0
;
}
if
(
!
strcmp
(
argv
[
i
],
"-extensions"
))
{
return
1
;
return
1
;
}
#ifdef RENDER
if
(
!
strcmp
(
argv
[
i
],
"-norender"
))
{
nxagentRenderEnable
=
False
;
return
1
;
}
#endif
...
...
@@ -746,14 +713,12 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if
(
!
strcmp
(
argv
[
i
],
"-nocomposite"
))
{
nxagentChangeOption
(
Composite
,
0
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-nodamage"
))
{
nxagentChangeOption
(
UseDamage
,
0
);
return
1
;
}
...
...
@@ -763,67 +728,57 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
/*
* The original -noreset option, disabling
* dispatchExceptionAtReset, is the default.
* Use this option to restore the original
* The original -noreset option, disabling dispatchExceptionAtReset,
* is the default. Use this option to restore the original
* behaviour.
*/
if
(
!
strcmp
(
argv
[
i
],
"-reset"
))
{
nxagentChangeOption
(
Reset
,
True
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-persistent"
))
{
nxagentChangeOption
(
Persistent
,
True
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-nopersistent"
))
{
nxagentChangeOption
(
Persistent
,
False
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-noshmem"
))
{
nxagentChangeOption
(
SharedMemory
,
False
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-shmem"
))
{
nxagentChangeOption
(
SharedMemory
,
True
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-noignore"
))
{
nxagentChangeOption
(
DeviceControl
,
True
);
nxagentChangeOption
(
DeviceControlUserDefined
,
True
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-nokbreset"
))
{
nxagentChangeOption
(
ResetKeyboardAtResume
,
False
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-noxkblock"
))
{
nxagentChangeOption
(
InhibitXkb
,
0
);
return
1
;
}
...
...
@@ -845,8 +800,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
/*
* Enable the "desktop" mode. This is
* the default.
* Enable the "desktop" mode. This is the default.
*/
if
(
!
strcmp
(
argv
[
i
],
"-D"
))
...
...
@@ -854,7 +808,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
nxagentChangeOption
(
Binder
,
False
);
nxagentChangeOption
(
Rootless
,
False
);
nxagentChangeOption
(
Desktop
,
True
);
return
1
;
}
...
...
@@ -867,7 +820,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
nxagentChangeOption
(
Shadow
,
1
);
nxagentChangeOption
(
DeferLevel
,
0
);
nxagentChangeOption
(
Persistent
,
0
);
return
1
;
}
...
...
@@ -881,10 +833,8 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
FatalError
(
"Invalid shadow display option"
);
}
return
2
;
}
return
0
;
}
...
...
@@ -901,10 +851,8 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
ViewOnly
,
0
);
}
return
2
;
}
return
0
;
}
...
...
@@ -926,18 +874,15 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
nxagentChangeOption
(
Timeout
,
seconds
);
return
2
;
}
}
return
0
;
}
/*
* The return value for -query, -broadcast and
* -indirect must be 0 to let the dix layer pro-
* cess these options.
* The return value for -query, -broadcast and -indirect must be 0
* to let the dix layer process these options.
*/
if
(
!
strcmp
(
argv
[
i
],
"-query"
))
...
...
@@ -945,9 +890,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
Desktop
,
True
);
nxagentChangeOption
(
Xdmcp
,
True
);
nxagentMaxAllowedResets
=
0
;
return
0
;
}
...
...
@@ -956,9 +899,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
Desktop
,
True
);
nxagentChangeOption
(
Xdmcp
,
True
);
nxagentMaxAllowedResets
=
0
;
return
0
;
}
...
...
@@ -966,23 +907,19 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
Desktop
,
True
);
nxagentChangeOption
(
Xdmcp
,
True
);
nxagentMaxAllowedResets
=
1
;
return
0
;
}
if
(
!
strcmp
(
argv
[
i
],
"-noshpix"
))
{
nxagentChangeOption
(
SharedPixmaps
,
False
);
return
1
;
}
if
(
!
strcmp
(
argv
[
i
],
"-shpix"
))
{
nxagentChangeOption
(
SharedPixmaps
,
True
);
return
1
;
}
...
...
@@ -1000,7 +937,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
Clipboard
,
ClipboardServer
);
}
else
if
((
!
strcmp
(
argv
[
i
+
1
],
"none"
))
||
(
!
strcmp
(
argv
[
i
+
1
],
"
1
"
)))
else
if
((
!
strcmp
(
argv
[
i
+
1
],
"none"
))
||
(
!
strcmp
(
argv
[
i
+
1
],
"
0
"
)))
{
nxagentChangeOption
(
Clipboard
,
ClipboardNone
);
}
...
...
@@ -1008,7 +945,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
nxagentChangeOption
(
Clipboard
,
ClipboardBoth
);
}
return
2
;
}
...
...
@@ -1021,7 +957,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if
(
!
strcmp
(
argv
[
i
],
"-verbose"
))
{
nxagentVerbose
=
1
;
return
1
;
}
...
...
@@ -1042,11 +977,9 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if
(
!
strcmp
(
argv
[
i
],
"-autograb"
))
{
nxagentChangeOption
(
AutoGrab
,
True
);
return
1
;
}
/*
* Disable Xinerama (i.e. fake it in Screen.c) if somehow Xinerama support
* has been disabled on the cmdline.
...
...
@@ -1058,21 +991,21 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
/* copy from nxcomp's Loop.cpp */
static
int
hexval
(
char
c
)
{
if
((
c
>=
'0'
)
&&
(
c
<=
'9'
))
return
c
-
'0'
;
if
((
c
>=
'a'
)
&&
(
c
<=
'f'
))
return
c
-
'a'
+
10
;
if
((
c
>=
'A'
)
&&
(
c
<=
'F'
))
return
c
-
'A'
+
10
;
return
-
1
;
static
int
hexval
(
char
c
)
{
if
((
c
>=
'0'
)
&&
(
c
<=
'9'
))
return
c
-
'0'
;
if
((
c
>=
'a'
)
&&
(
c
<=
'f'
))
return
c
-
'a'
+
10
;
if
((
c
>=
'A'
)
&&
(
c
<=
'F'
))
return
c
-
'A'
+
10
;
return
-
1
;
}
static
void
URLDecodeInPlace
(
char
*
str
)
static
void
URLDecodeInPlace
(
char
*
str
)
{
if
(
str
)
{
if
(
str
)
{
char
*
to
=
str
;
while
(
str
[
0
])
{
...
...
@@ -1092,7 +1025,7 @@ URLDecodeInPlace(char *str)
static
void
nxagentParseSingleOption
(
char
*
name
,
char
*
value
)
{
int
size
,
argc
;
int
argc
;
char
*
argv
[
2
]
=
{
NULL
,
NULL
};
...
...
@@ -1121,7 +1054,6 @@ static void nxagentParseSingleOption(char *name, char *value)
!
strcmp
(
name
,
"tile"
))
{
argv
[
1
]
=
value
;
argc
=
2
;
}
else
if
(
!
strcmp
(
name
,
"R"
)
&&
!
strcmp
(
value
,
"1"
))
...
...
@@ -1131,7 +1063,6 @@ static void nxagentParseSingleOption(char *name, char *value)
else
if
(
!
strcmp
(
name
,
"fast"
)
||
!
strcmp
(
name
,
"slow"
))
{
fprintf
(
stderr
,
"Warning: Ignoring deprecated option '%s'.
\n
"
,
name
);
return
;
}
else
if
(
!
strcmp
(
name
,
"render"
))
...
...
@@ -1158,7 +1089,6 @@ static void nxagentParseSingleOption(char *name, char *value)
validateString
(
value
));
}
}
return
;
}
else
if
(
!
strcmp
(
name
,
"state"
))
...
...
@@ -1177,13 +1107,11 @@ static void nxagentParseSingleOption(char *name, char *value)
else
if
(
!
strcmp
(
value
,
"1"
))
{
nxagentChangeOption
(
Fullscreen
,
True
);
nxagentChangeOption
(
AllScreens
,
True
);
}
else
if
(
!
strcmp
(
value
,
"0"
))
{
nxagentChangeOption
(
Fullscreen
,
False
);
nxagentChangeOption
(
AllScreens
,
False
);
}
else
...
...
@@ -1209,7 +1137,6 @@ static void nxagentParseSingleOption(char *name, char *value)
fprintf
(
stderr
,
"Warning: Ignoring bad value '%s' for option 'shpix'.
\n
"
,
validateString
(
value
));
}
return
;
}
else
if
(
!
strcmp
(
name
,
"shmem"
))
...
...
@@ -1245,7 +1172,6 @@ static void nxagentParseSingleOption(char *name, char *value)
fprintf
(
stderr
,
"Warning: Ignoring bad value '%s' for option 'composite'.
\n
"
,
validateString
(
value
));
}
return
;
}
else
if
(
!
strcmp
(
name
,
"xinerama"
))
...
...
@@ -1294,7 +1220,6 @@ static void nxagentParseSingleOption(char *name, char *value)
fprintf
(
stderr
,
"Warning: Ignoring bad value '%s' for option 'resize'.
\n
"
,
validateString
(
value
));
}
return
;
}
else
if
(
!
strcmp
(
name
,
"backingstore"
))
...
...
@@ -1307,7 +1232,6 @@ static void nxagentParseSingleOption(char *name, char *value)
{
nxagentChangeOption
(
BackingStore
,
BackingStoreForce
);
}
return
;
}
else
if
(
!
strcmp
(
name
,
"menu"
))
...
...
@@ -1320,7 +1244,6 @@ static void nxagentParseSingleOption(char *name, char *value)
{
nxagentChangeOption
(
Menu
,
1
);
}
return
;
}
else
if
(
!
strcmp
(
name
,
"magicpixel"
))
...
...
@@ -1333,7 +1256,6 @@ static void nxagentParseSingleOption(char *name, char *value)
{
nxagentChangeOption
(
MagicPixel
,
1
);
}
return
;
}
else
if
(
!
strcmp
(
name
,
"autodpi"
))
...
...
@@ -1352,19 +1274,16 @@ static void nxagentParseSingleOption(char *name, char *value)
{
nxagentAutoDPI
=
True
;
}
return
;
}
else
if
(
strcmp
(
name
,
"shadowuid"
)
==
0
)
{
nxagentShadowUid
=
atoi
(
value
);
return
;
}
else
if
(
strcmp
(
name
,
"clients"
)
==
0
)
{
snprintf
(
nxagentClientsLogName
,
NXAGENTCLIENTSLOGNAMELENGTH
,
"%s"
,
value
);
return
;
}
else
if
(
strcmp
(
name
,
"client"
)
==
0
)
...
...
@@ -1385,51 +1304,23 @@ static void nxagentParseSingleOption(char *name, char *value)
{
nxagentChangeOption
(
ClientOs
,
ClientOsMac
);
}
return
;
}
else
if
(
strcmp
(
name
,
"copysize"
)
==
0
)
{
nxagentChangeOption
(
CopyBufferSize
,
atoi
(
value
));
return
;
}
else
if
(
strcmp
(
name
,
"clipboard"
)
==
0
)
{
if
((
strcmp
(
value
,
"both"
)
==
0
)
||
(
strcmp
(
value
,
"1"
)
==
0
))
{
nxagentChangeOption
(
Clipboard
,
ClipboardBoth
);
}
else
if
(
strcmp
(
value
,
"client"
)
==
0
)
{
nxagentChangeOption
(
Clipboard
,
ClipboardClient
);
}
else
if
(
strcmp
(
value
,
"server"
)
==
0
)
{
nxagentChangeOption
(
Clipboard
,
ClipboardServer
);
}
else
if
((
strcmp
(
value
,
"none"
)
==
0
)
||
(
strcmp
(
value
,
"0"
)
==
0
))
{
nxagentChangeOption
(
Clipboard
,
ClipboardNone
);
}
else
{
nxagentChangeOption
(
Clipboard
,
ClipboardBoth
);
}
}
else
if
(
!
strcmp
(
name
,
"sleep"
))
{
long
sleep_parse
=
0
;
errno
=
0
;
sleep_parse
=
strtol
(
value
,
NULL
,
10
);
long
sleep_parse
=
strtol
(
value
,
NULL
,
10
);
if
((
errno
)
&&
(
0
==
sleep_parse
))
{
fprintf
(
stderr
,
"
nxagentParseSingleOption:
Unable to convert value [%s] of option [%s]. "
fprintf
(
stderr
,
"Unable to convert value [%s] of option [%s]. "
"Ignoring option.
\n
"
,
validateString
(
value
),
validateString
(
name
));
return
;
}
...
...
@@ -1437,7 +1328,7 @@ static void nxagentParseSingleOption(char *name, char *value)
{
sleep_parse
=
UINT_MAX
;
fprintf
(
stderr
,
"
nxagentParseSingleOption:
Warning: value [%s] of option [%s] "
fprintf
(
stderr
,
"Warning: value [%s] of option [%s] "
"out of range, clamped to [%lu].
\n
"
,
validateString
(
value
),
validateString
(
name
),
sleep_parse
);
}
...
...
@@ -1446,13 +1337,12 @@ static void nxagentParseSingleOption(char *name, char *value)
{
sleep_parse
=
0
;
fprintf
(
stderr
,
"
nxagentParseSingleOption:
Warning: value [%s] of option [%s] "
fprintf
(
stderr
,
"Warning: value [%s] of option [%s] "
"out of range, clamped to [%lu].
\n
"
,
validateString
(
value
),
validateString
(
name
),
sleep_parse
);
}
nxagentChangeOption
(
SleepTime
,
sleep_parse
);
return
;
}
else
if
(
!
strcmp
(
name
,
"tolerancechecks"
))
...
...
@@ -1478,17 +1368,15 @@ static void nxagentParseSingleOption(char *name, char *value)
/*
* Check for a matching integer. Or any integer, really.
*/
long
tolerance_parse
=
0
;
errno
=
0
;
tolerance_parse
=
strtol
(
value
,
NULL
,
10
);
long
tolerance_parse
=
strtol
(
value
,
NULL
,
10
);
if
((
errno
)
&&
(
0
==
tolerance_parse
))
{
fprintf
(
stderr
,
"
nxagentParseSingleOption:
Unable to convert value [%s] of option [%s]. "
fprintf
(
stderr
,
"Unable to convert value [%s] of option [%s]. "
"Ignoring option.
\n
"
,
validateString
(
value
),
validateString
(
name
));
return
;
}
...
...
@@ -1496,7 +1384,7 @@ static void nxagentParseSingleOption(char *name, char *value)
{
tolerance_parse
=
UINT_MAX
;
fprintf
(
stderr
,
"
nxagentParseSingleOption:
Warning: value [%s] of option [%s] "
fprintf
(
stderr
,
"Warning: value [%s] of option [%s] "
"out of range, clamped to [%lu].
\n
"
,
validateString
(
value
),
validateString
(
name
),
tolerance_parse
);
}
...
...
@@ -1505,7 +1393,7 @@ static void nxagentParseSingleOption(char *name, char *value)
{
tolerance_parse
=
0
;
fprintf
(
stderr
,
"
nxagentParseSingleOption:
Warning: value [%s] of option [%s] "
fprintf
(
stderr
,
"Warning: value [%s] of option [%s] "
"out of range, clamped to [%lu].
\n
"
,
validateString
(
value
),
validateString
(
name
),
tolerance_parse
);
}
...
...
@@ -1516,19 +1404,18 @@ static void nxagentParseSingleOption(char *name, char *value)
case
ToleranceChecksSafe
:
case
ToleranceChecksRisky
:
case
ToleranceChecksBypass
:
break
;
break
;
default:
fprintf
(
stderr
,
"nxagentParseSingleOption
: Warning: value [%s] of "
"option [%s] unknown, will be mapped to "
"
\"
Bypass
\"
[%u] value internally.
\n
"
,
validateString
(
value
),
validateString
(
name
),
(
unsigned
int
)
ToleranceChecksBypass
);
fprintf
(
stderr
,
"%s
: Warning: value [%s] of "
"option [%s] unknown, will be mapped to "
"
\"
Bypass
\"
[%u] value internally.
\n
"
,
__func__
,
validateString
(
value
),
validateString
(
name
),
(
unsigned
int
)
ToleranceChecksBypass
);
}
#endif
nxagentChangeOption
(
ReconnectTolerance
,
tolerance_parse
);
}
return
;
}
else
if
(
!
strcmp
(
name
,
"keyconv"
))
...
...
@@ -1547,7 +1434,6 @@ static void nxagentParseSingleOption(char *name, char *value)
fprintf
(
stderr
,
"Warning: Ignoring bad value '%s' for option 'keyconv'.
\n
"
,
validateString
(
value
));
}
return
;
}
else
if
(
!
strcmp
(
name
,
"autograb"
))
...
...
@@ -1560,7 +1446,6 @@ static void nxagentParseSingleOption(char *name, char *value)
{
nxagentChangeOption
(
AutoGrab
,
True
);
}
return
;
}
else
...
...
@@ -1569,23 +1454,22 @@ static void nxagentParseSingleOption(char *name, char *value)
fprintf
(
stderr
,
"nxagentParseSingleOption: Ignored option [%s] with value [%s].
\n
"
,
validateString
(
name
),
validateString
(
value
));
#endif
return
;
}
/*
* Before passing the not yet evaluated options
* to ddxProcessArgument(), we have to add a dash
* as prefix.
* Before passing the not yet evaluated options to
* ddxProcessArgument(), we have to add a dash as prefix.
*/
if
((
size
=
strlen
(
name
)
+
1
)
>
1
)
int
size
=
strlen
(
name
)
+
1
;
if
(
size
>
1
)
{
if
((
argv
[
0
]
=
malloc
(
size
+
1
))
==
NULL
)
{
fprintf
(
stderr
,
"Warning: Ignoring option '%s' due to lack of memory.
\n
"
,
name
);
return
;
}
...
...
@@ -1603,13 +1487,12 @@ static void nxagentParseOptionString(char *string)
{
char
*
value
=
NULL
;
char
*
option
=
NULL
;
char
*
delimiter
=
NULL
;
/*
* Remove the port specification.
*/
delimiter
=
rindex
(
string
,
':'
);
char
*
delimiter
=
rindex
(
string
,
':'
);
if
(
delimiter
)
{
...
...
@@ -1671,9 +1554,6 @@ void nxagentProcessOptionsFile(char * filename)
FILE
*
file
=
NULL
;
char
*
data
=
NULL
;
int
offset
;
int
size
;
int
sizeOfFile
;
int
maxFileSize
=
1024
;
...
...
@@ -1696,7 +1576,6 @@ void nxagentProcessOptionsFile(char * filename)
{
fprintf
(
stderr
,
"Warning: Couldn't open option file '%s'. Error is '%s'.
\n
"
,
validateString
(
filename
),
strerror
(
errno
));
goto
nxagentProcessOptionsFileExit
;
}
...
...
@@ -1704,7 +1583,6 @@ void nxagentProcessOptionsFile(char * filename)
{
fprintf
(
stderr
,
"Warning: Couldn't position inside option file '%s'. Error is '%s'.
\n
"
,
validateString
(
filename
),
strerror
(
errno
));
goto
nxagentProcessOptionsFileExit
;
}
...
...
@@ -1712,7 +1590,6 @@ void nxagentProcessOptionsFile(char * filename)
{
fprintf
(
stderr
,
"Warning: Couldn't get the size of option file '%s'. Error is '%s'.
\n
"
,
validateString
(
filename
),
strerror
(
errno
));
goto
nxagentProcessOptionsFileExit
;
}
...
...
@@ -1727,7 +1604,6 @@ void nxagentProcessOptionsFile(char * filename)
{
fprintf
(
stderr
,
"Warning: Maximum file size exceeded for options '%s'.
\n
"
,
validateString
(
filename
));
goto
nxagentProcessOptionsFileExit
;
}
...
...
@@ -1735,12 +1611,11 @@ void nxagentProcessOptionsFile(char * filename)
{
fprintf
(
stderr
,
"Warning: Memory allocation failed processing file '%s'.
\n
"
,
validateString
(
filename
));
goto
nxagentProcessOptionsFileExit
;
}
offset
=
0
;
size
=
0
;
int
offset
=
0
;
int
size
=
0
;
for
(;;)
{
...
...
@@ -1750,7 +1625,6 @@ void nxagentProcessOptionsFile(char * filename)
{
fprintf
(
stderr
,
"Warning: Error reading the option file '%s'.
\n
"
,
validateString
(
filename
));
goto
nxagentProcessOptionsFileExit
;
}
...
...
@@ -1767,7 +1641,6 @@ void nxagentProcessOptionsFile(char * filename)
{
fprintf
(
stderr
,
"Warning: Premature end of option file '%s' while reading.
\n
"
,
validateString
(
filename
));
goto
nxagentProcessOptionsFileExit
;
}
...
...
@@ -1899,9 +1772,6 @@ N/A
unsigned
int
saveCache
=
0
;
unsigned
int
startupCache
=
0
;
unsigned
int
enableClient
=
0
;
unsigned
int
enableServer
=
0
;
unsigned
int
clientSegment
=
0
;
unsigned
int
serverSegment
=
0
;
...
...
@@ -1959,8 +1829,7 @@ N/A
}
/*
* Set the minimum size of images being
* streamed.
* Set the minimum size of images being streamed.
*/
if
(
nxagentSplitThreshold
==
-
1
)
...
...
@@ -1969,17 +1838,15 @@ N/A
}
/*
* Let the remote proxy use the shared memory
* extension, if supported by the X server.
* The client part is not useful and not impl-
* emented. The size of the segment is chosen
* by the user. The only purpose of the message
* is to reserve the XID that will be used by
* the remote.
* Let the remote proxy use the shared memory extension, if
* supported by the X server. The client part is not useful and
* not implemented. The size of the segment is chosen by the
* user. The only purpose of the message is to reserve the XID
* that will be used by the remote.
*/
enableClient
=
0
;
enableServer
=
1
;
unsigned
int
enableClient
=
0
;
unsigned
int
enableServer
=
1
;
if
(
NXGetShmemParameters
(
dpy
,
&
enableClient
,
&
enableServer
,
&
clientSegment
,
&
serverSegment
,
&
clientSize
,
&
serverSize
)
==
0
)
...
...
@@ -2000,8 +1867,8 @@ N/A
}
/*
* We don't need the NoExpose events. Block
*
them at the proxy
side.
* We don't need the NoExpose events. Block
them at the proxy
* side.
*/
NXSetExposeParameters
(
nxagentDisplay
,
1
,
1
,
0
);
...
...
@@ -2016,17 +1883,15 @@ N/A
}
/*
* Set the lossless and lossy pack methods
* based on the user's preferences and the
* selected link type.
* Set the lossless and lossy pack methods based on the user's
* preferences and the selected link type.
*/
nxagentSetPackMethod
();
/*
* If not set, set the defer level and the
* synchronization timeout based on the link
* type.
* If not set, set the defer level and the synchronization timeout
* based on the link type.
*/
nxagentSetDeferLevel
();
...
...
@@ -2100,9 +1965,8 @@ FIXME: In rootless mode the backing-store support is not functional yet.
}
/*
* need to check if this was set on the
* command line as this has the priority
* over the option file.
* need to check if this was set on the command line as this has
* the priority over the option file.
*/
if
(
nxagentRenderEnable
==
UNDEFINED
)
...
...
@@ -2125,8 +1989,7 @@ FIXME: In rootless mode the backing-store support is not functional yet.
}
/*
* We enable server reset only for indirect
* XDMCP sessions.
* We enable server reset only for indirect XDMCP sessions.
*/
if
(
nxagentOption
(
Reset
)
==
True
&&
nxagentMaxAllowedResets
==
0
)
...
...
@@ -2141,9 +2004,8 @@ FIXME: In rootless mode the backing-store support is not functional yet.
}
/*
* We skip server reset by default. This should
* be equivalent to passing the -noreset option
* to a standard XFree86 server.
* We skip server reset by default. This should be equivalent to
* passing the -noreset option to a standard XFree86 server.
*/
if
(
nxagentOption
(
Reset
)
==
False
)
...
...
@@ -2156,8 +2018,7 @@ FIXME: In rootless mode the backing-store support is not functional yet.
}
/*
* Check if the user activated the auto-disconect
* feature.
* Check if the user activated the auto-disconect feature.
*/
if
(
nxagentOption
(
Timeout
)
>
0
)
...
...
@@ -2258,8 +2119,6 @@ void nxagentSetPackMethod(void)
unsigned
char
supportedMethods
[
NXNumberOfPackMethods
];
unsigned
int
entries
=
NXNumberOfPackMethods
;
int
method
;
if
(
nxagentOption
(
LinkType
)
==
LINK_TYPE_NONE
)
{
nxagentChangeOption
(
Streaming
,
0
);
...
...
@@ -2273,12 +2132,11 @@ void nxagentSetPackMethod(void)
}
/*
* Check if we need to select the lossy
* and lossless pack methods based on
* the link type.
* Check if we need to select the lossy and lossless pack methods
* based on the link type.
*/
method
=
nxagentPackMethod
;
int
method
=
nxagentPackMethod
;
if
(
method
==
PACK_ADAPTIVE
)
{
...
...
@@ -2311,29 +2169,25 @@ void nxagentSetPackMethod(void)
case
LINK_TYPE_WAN
:
{
nxagentPackMethod
=
PACK_BITMAP_16M_COLORS
;
break
;
}
case
LINK_TYPE_LAN
:
{
nxagentPackMethod
=
PACK_RLE_16M_COLORS
;
break
;
}
default:
{
fprintf
(
stderr
,
"Warning: Unknown link type '%d' while setting the pack method.
\n
"
,
nxagentOption
(
LinkType
));
break
;
}
}
}
/*
* Query the remote proxy to determine
* whether the selected methods are
* supported.
* Query the remote proxy to determine whether the selected methods
* are supported.
*/
if
(
NXGetUnpackParameters
(
nxagentDisplay
,
&
entries
,
supportedMethods
)
==
0
||
...
...
@@ -2416,15 +2270,15 @@ void nxagentSetPackMethod(void)
void
nxagentSetDeferLevel
(
void
)
{
int
deferLevel
;
int
tileWidth
;
int
tileHeight
;
int
deferTimeout
;
/* defaults */
int
deferLevel
=
0
;
int
tileWidth
=
64
;
int
tileHeight
=
64
;
int
deferTimeout
=
200
;
/*
* Streaming is only partly implemented
* and is not available in this version
* of the agent.
* Streaming is only partly implemented and is not available in this
* version of the agent.
*/
if
(
nxagentOption
(
Streaming
)
==
1
)
...
...
@@ -2434,76 +2288,18 @@ void nxagentSetDeferLevel(void)
nxagentChangeOption
(
Streaming
,
0
);
}
switch
(
nxagentOption
(
LinkType
))
switch
(
nxagentOption
(
LinkType
))
{
case
LINK_TYPE_MODEM
:
{
deferLevel
=
2
;
tileWidth
=
64
;
tileHeight
=
64
;
deferTimeout
=
200
;
break
;
}
case
LINK_TYPE_ISDN
:
{
deferLevel
=
2
;
tileWidth
=
64
;
tileHeight
=
64
;
deferTimeout
=
200
;
break
;
}
case
LINK_TYPE_ADSL
:
{
deferLevel
=
2
;
deferTimeout
=
200
;
tileWidth
=
4096
;
tileHeight
=
4096
;
break
;
}
case
LINK_TYPE_WAN
:
{
deferLevel
=
1
;
deferTimeout
=
200
;
tileWidth
=
4096
;
tileHeight
=
4096
;
break
;
}
case
LINK_TYPE_ISDN
:
{
deferLevel
=
2
;
tileWidth
=
64
;
tileHeight
=
64
;
break
;
}
case
LINK_TYPE_ADSL
:
{
deferLevel
=
2
;
tileWidth
=
4096
;
tileHeight
=
4096
;
break
;
}
case
LINK_TYPE_WAN
:
{
deferLevel
=
1
;
tileWidth
=
4096
;
tileHeight
=
4096
;
break
;
}
case
LINK_TYPE_NONE
:
case
LINK_TYPE_LAN
:
{
deferLevel
=
0
;
deferTimeout
=
200
;
tileWidth
=
4096
;
tileHeight
=
4096
;
break
;
}
case
LINK_TYPE_LAN
:
{
deferLevel
=
0
;
tileWidth
=
4096
;
tileHeight
=
4096
;
break
;
}
default:
{
fprintf
(
stderr
,
"Warning: Unknown link type [%d] processing the defer option.
\n
"
,
nxagentOption
(
LinkType
));
deferLevel
=
0
;
tileWidth
=
64
;
tileHeight
=
64
;
deferTimeout
=
200
;
break
;
}
}
...
...
@@ -2596,48 +2392,20 @@ void nxagentSetDeferLevel(void)
void
nxagentSetBufferSize
(
void
)
{
int
size
;
int
size
=
16384
;
switch
(
nxagentOption
(
LinkType
))
{
case
LINK_TYPE_MODEM
:
{
size
=
4096
;
break
;
}
case
LINK_TYPE_ISDN
:
{
size
=
4096
;
break
;
}
case
LINK_TYPE_ADSL
:
{
size
=
8192
;
break
;
}
case
LINK_TYPE_WAN
:
{
size
=
16384
;
break
;
}
case
LINK_TYPE_MODEM
:
{
size
=
4096
;
break
;
}
case
LINK_TYPE_ISDN
:
{
size
=
4096
;
break
;
}
case
LINK_TYPE_ADSL
:
{
size
=
8192
;
break
;
}
case
LINK_TYPE_WAN
:
{
size
=
16384
;
break
;
}
case
LINK_TYPE_NONE
:
case
LINK_TYPE_LAN
:
{
size
=
16384
;
break
;
}
case
LINK_TYPE_LAN
:
{
size
=
16384
;
break
;
}
default:
{
fprintf
(
stderr
,
"Warning: Unknown link type '%d' while setting the display buffer size.
\n
"
,
nxagentOption
(
LinkType
));
size
=
16384
;
break
;
}
}
...
...
@@ -2671,48 +2439,20 @@ void nxagentSetScheduler(void)
void
nxagentSetCoalescence
(
void
)
{
int
timeout
;
int
timeout
=
0
;
switch
(
nxagentOption
(
LinkType
))
{
case
LINK_TYPE_MODEM
:
{
timeout
=
50
;
break
;
}
case
LINK_TYPE_ISDN
:
{
timeout
=
20
;
break
;
}
case
LINK_TYPE_ADSL
:
{
timeout
=
10
;
break
;
}
case
LINK_TYPE_WAN
:
{
timeout
=
5
;
break
;
}
case
LINK_TYPE_MODEM
:
{
timeout
=
50
;
break
;
}
case
LINK_TYPE_ISDN
:
{
timeout
=
20
;
break
;
}
case
LINK_TYPE_ADSL
:
{
timeout
=
10
;
break
;
}
case
LINK_TYPE_WAN
:
{
timeout
=
5
;
break
;
}
case
LINK_TYPE_NONE
:
case
LINK_TYPE_LAN
:
{
timeout
=
0
;
break
;
}
case
LINK_TYPE_LAN
:
{
timeout
=
0
;
break
;
}
default:
{
fprintf
(
stderr
,
"Warning: Unknown link type '%d' while setting the display coalescence.
\n
"
,
nxagentOption
(
LinkType
));
timeout
=
0
;
break
;
}
}
...
...
@@ -2727,5 +2467,5 @@ void nxagentSetCoalescence(void)
void
nxagentShowVersionInfo
(
void
)
{
ErrorF
(
"NXAGENT - Version "
NX_VERSION_CURRENT_STRING
"
\n
"
);
ErrorF
(
"NXAGENT - Version "
NX_VERSION_CURRENT_STRING
"
\n
"
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment