Skip to content

Commit ea9a206

Browse files
committed
Args.c: add some comments and FIXMEs
1 parent dda7d42 commit ea9a206

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
@@ -181,6 +181,9 @@ Bool nxagentVerbose = False;
181181

182182
char *nxagentKeystrokeFile = NULL;
183183

184+
/*
185+
* This is the entry point, called from os/utils.c
186+
*/
184187
int ddxProcessArgument(int argc, char *argv[], int i)
185188
{
186189
/*
@@ -191,6 +194,11 @@ int ddxProcessArgument(int argc, char *argv[], int i)
191194

192195
static Bool resetOptions = True;
193196

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+
*/
194202
if (resetOptions == True)
195203
{
196204
char *envOptions = NULL;
@@ -202,10 +210,9 @@ int ddxProcessArgument(int argc, char *argv[], int i)
202210
resetOptions = False;
203211

204212
/*
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.
209216
*/
210217

211218
envDisplay = getenv("DISPLAY");
@@ -237,6 +244,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
237244

238245
if (envOptions != NULL)
239246
{
247+
/* envOptions will be modified! */
240248
nxagentParseOptionString(envOptions);
241249
free(envOptions);
242250
}
@@ -668,6 +676,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
668676
return 0;
669677
}
670678

679+
/* FIXME: seems to be ignored; is not documented */
671680
if (!strcmp(argv[i], "-extensions"))
672681
{
673682
return 1;
@@ -967,6 +976,10 @@ static void nxagentParseOptions(char *name, char *value)
967976
validateString(name), validateString(value));
968977
#endif
969978

979+
/*
980+
* these options are also command line options (prefixed with "-")
981+
* and require an argument. They are handled by ddxProcessArgument()
982+
*/
970983
if (!strcmp(name, "kbtype") ||
971984
!strcmp(name, "keyboard") ||
972985
!strcmp(name, "id") ||
@@ -986,13 +999,21 @@ static void nxagentParseOptions(char *name, char *value)
986999
}
9871000
else if (!strcmp(name, "R") && !strcmp(value, "1"))
9881001
{
1002+
/*
1003+
* this option is a command line option and requires no
1004+
* argument. It is handled by ddxProcessArgument()
1005+
*/
9891006
argc = 1;
9901007
}
9911008
else if (!strcmp(name, "fast") || !strcmp(name, "slow"))
9921009
{
9931010
fprintf(stderr, "Warning: Ignoring deprecated option '%s'.\n", name);
9941011
return;
9951012
}
1013+
/*
1014+
* the following options are only allowed in the options parameter and
1015+
* always require an argument.
1016+
*/
9961017
else if (!strcmp(name, "render"))
9971018
{
9981019
if (nxagentReconnectTrap == True)
@@ -1499,7 +1520,7 @@ void nxagentProcessOptionsFile(char * filename)
14991520
int size;
15001521

15011522
int sizeOfFile;
1502-
int maxFileSize = 1024;
1523+
int maxFileSize = 1024; /* FIXME: why? */
15031524

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

0 commit comments

Comments
 (0)