Skip to content

Commit f73d272

Browse files
committed
Args.c: add some comments and FIXMEs
1 parent 5c1186b commit f73d272

File tree

1 file changed

+26
-5
lines changed
  • nx-X11/programs/Xserver/hw/nxagent

1 file changed

+26
-5
lines changed

nx-X11/programs/Xserver/hw/nxagent/Args.c

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ Bool nxagentVerbose = False;
179179

180180
char *nxagentKeystrokeFile = NULL;
181181

182+
/*
183+
* This is the entry point, called from os/utils.c
184+
*/
182185
int ddxProcessArgument(int argc, char *argv[], int i)
183186
{
184187
/*
@@ -187,6 +190,11 @@ int ddxProcessArgument(int argc, char *argv[], int i)
187190

188191
static Bool resetOptions = True;
189192

193+
/*
194+
* the first call of ddxProcessArgument is used to setup defaults
195+
* and read/process the options from environment and/or the options
196+
* file.
197+
*/
190198
if (resetOptions == True)
191199
{
192200
char *envOptions = NULL;
@@ -198,10 +206,9 @@ int ddxProcessArgument(int argc, char *argv[], int i)
198206
resetOptions = False;
199207

200208
/*
201-
* Ensure the correct order of options evaluation:
202-
* the environment first, then those included in
203-
* the options file and, last, the command line
204-
* options.
209+
* Ensure the correct order of options evaluation: the -display
210+
* option first, then the environment, then those included in the
211+
* options file and, last, the command line options.
205212
*/
206213

207214
envDisplay = getenv("DISPLAY");
@@ -233,6 +240,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
233240

234241
if (envOptions != NULL)
235242
{
243+
/* envOptions will be modified! */
236244
nxagentParseOptionString(envOptions);
237245
free(envOptions);
238246
}
@@ -677,6 +685,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
677685
return 0;
678686
}
679687

688+
/* FIXME: seems to be ignored; is not documented */
680689
if (!strcmp(argv[i], "-extensions"))
681690
{
682691
return 1;
@@ -973,6 +982,10 @@ static void nxagentParseOptions(char *name, char *value)
973982
validateString(name), validateString(value));
974983
#endif
975984

985+
/*
986+
* these options are also command line options (prefixed with "-")
987+
* and require an argument. They are handled by ddxProcessArgument()
988+
*/
976989
if (!strcmp(name, "kbtype") ||
977990
!strcmp(name, "keyboard") ||
978991
!strcmp(name, "id") ||
@@ -992,13 +1005,21 @@ static void nxagentParseOptions(char *name, char *value)
9921005
}
9931006
else if (!strcmp(name, "R") && !strcmp(value, "1"))
9941007
{
1008+
/*
1009+
* this option is a command line option and requires no
1010+
* argument. It is handled by ddxProcessArgument()
1011+
*/
9951012
argc = 1;
9961013
}
9971014
else if (!strcmp(name, "fast") || !strcmp(name, "slow"))
9981015
{
9991016
fprintf(stderr, "Warning: Ignoring deprecated option '%s'.\n", name);
10001017
return;
10011018
}
1019+
/*
1020+
* the following options are only allowed in the options parameter and
1021+
* always require an argument.
1022+
*/
10021023
else if (!strcmp(name, "render"))
10031024
{
10041025
if (nxagentReconnectTrap == True)
@@ -1454,7 +1475,7 @@ void nxagentProcessOptionsFile(char * filename)
14541475
int size;
14551476

14561477
int sizeOfFile;
1457-
int maxFileSize = 1024;
1478+
int maxFileSize = 1024; /* FIXME: why? */
14581479

14591480
#ifdef DEBUG
14601481
fprintf(stderr, "nxagentProcessOptionsFile: Going to process option file [%s].\n",

0 commit comments

Comments
 (0)