@@ -181,6 +181,9 @@ Bool nxagentVerbose = False;
181
181
182
182
char * nxagentKeystrokeFile = NULL ;
183
183
184
+ /*
185
+ * This is the entry point, called from os/utils.c
186
+ */
184
187
int ddxProcessArgument (int argc , char * argv [], int i )
185
188
{
186
189
/*
@@ -191,6 +194,11 @@ int ddxProcessArgument(int argc, char *argv[], int i)
191
194
192
195
static Bool resetOptions = True ;
193
196
197
+ /*
198
+ * the first call of ddxProcessArgument is used to setup defaults
199
+ * and read/process the options from environment and/or the options
200
+ * file.
201
+ */
194
202
if (resetOptions == True )
195
203
{
196
204
char * envOptions = NULL ;
@@ -202,10 +210,9 @@ int ddxProcessArgument(int argc, char *argv[], int i)
202
210
resetOptions = False ;
203
211
204
212
/*
205
- * Ensure the correct order of options evaluation:
206
- * the environment first, then those included in
207
- * the options file and, last, the command line
208
- * options.
213
+ * Ensure the correct order of options evaluation: the -display
214
+ * option first, then the environment, then those included in the
215
+ * options file and, last, the command line options.
209
216
*/
210
217
211
218
envDisplay = getenv ("DISPLAY" );
@@ -237,6 +244,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
237
244
238
245
if (envOptions != NULL )
239
246
{
247
+ /* envOptions will be modified! */
240
248
nxagentParseOptionString (envOptions );
241
249
free (envOptions );
242
250
}
@@ -668,6 +676,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
668
676
return 0 ;
669
677
}
670
678
679
+ /* FIXME: seems to be ignored; is not documented */
671
680
if (!strcmp (argv [i ], "-extensions" ))
672
681
{
673
682
return 1 ;
@@ -967,6 +976,10 @@ static void nxagentParseOptions(char *name, char *value)
967
976
validateString (name ), validateString (value ));
968
977
#endif
969
978
979
+ /*
980
+ * these options are also command line options (prefixed with "-")
981
+ * and require an argument. They are handled by ddxProcessArgument()
982
+ */
970
983
if (!strcmp (name , "kbtype" ) ||
971
984
!strcmp (name , "keyboard" ) ||
972
985
!strcmp (name , "id" ) ||
@@ -986,13 +999,21 @@ static void nxagentParseOptions(char *name, char *value)
986
999
}
987
1000
else if (!strcmp (name , "R" ) && !strcmp (value , "1" ))
988
1001
{
1002
+ /*
1003
+ * this option is a command line option and requires no
1004
+ * argument. It is handled by ddxProcessArgument()
1005
+ */
989
1006
argc = 1 ;
990
1007
}
991
1008
else if (!strcmp (name , "fast" ) || !strcmp (name , "slow" ))
992
1009
{
993
1010
fprintf (stderr , "Warning: Ignoring deprecated option '%s'.\n" , name );
994
1011
return ;
995
1012
}
1013
+ /*
1014
+ * the following options are only allowed in the options parameter and
1015
+ * always require an argument.
1016
+ */
996
1017
else if (!strcmp (name , "render" ))
997
1018
{
998
1019
if (nxagentReconnectTrap == True )
@@ -1499,7 +1520,7 @@ void nxagentProcessOptionsFile(char * filename)
1499
1520
int size ;
1500
1521
1501
1522
int sizeOfFile ;
1502
- int maxFileSize = 1024 ;
1523
+ int maxFileSize = 1024 ; /* FIXME: why? */
1503
1524
1504
1525
#ifdef DEBUG
1505
1526
fprintf (stderr , "nxagentProcessOptionsFile: Going to process option file [%s].\n" ,
0 commit comments