Skip to content

Commit 399860a

Browse files
committed
Args.c: add some comments and FIXMEs
1 parent 706136c commit 399860a

File tree

1 file changed

+25
-1
lines changed
  • nx-X11/programs/Xserver/hw/nxagent

1 file changed

+25
-1
lines changed

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ Bool nxagentVerbose = False;
179179

180180
char *nxagentKeystrokeFile = NULL;
181181

182+
/*
183+
* This is the entry point, called from os/utils.c
184+
*/
185+
182186
int ddxProcessArgument(int argc, char *argv[], int i)
183187
{
184188
/*
@@ -187,6 +191,12 @@ int ddxProcessArgument(int argc, char *argv[], int i)
187191

188192
static Bool resetOptions = True;
189193

194+
/*
195+
* the first call of ddxProcessArgument is used to setup defaults
196+
* and read/process the options from environment and/or the options
197+
* file.
198+
*/
199+
190200
if (resetOptions == True)
191201
{
192202
char *envOptions = NULL;
@@ -233,6 +243,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
233243

234244
if (envOptions != NULL)
235245
{
246+
/* envOptions will be modified! */
236247
nxagentParseOptionString(envOptions);
237248
free(envOptions);
238249
}
@@ -681,6 +692,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
681692
return 0;
682693
}
683694

695+
/* FIXME: seems to be ignored; is not documented */
684696
if (!strcmp(argv[i], "-extensions"))
685697
{
686698
return 1;
@@ -977,6 +989,10 @@ static void nxagentParseOptions(char *name, char *value)
977989
validateString(name), validateString(value));
978990
#endif
979991

992+
/*
993+
* these options are also command line options (prefixed with "-")
994+
* and require an argument. They are handled by ddxProcessArgument()
995+
*/
980996
if (!strcmp(name, "kbtype") ||
981997
!strcmp(name, "keyboard") ||
982998
!strcmp(name, "id") ||
@@ -996,13 +1012,21 @@ static void nxagentParseOptions(char *name, char *value)
9961012
}
9971013
else if (!strcmp(name, "R") && !strcmp(value, "1"))
9981014
{
1015+
/*
1016+
* this option is a command line option and requires no
1017+
* argument. It is handled by ddxProcessArgument()
1018+
*/
9991019
argc = 1;
10001020
}
10011021
else if (!strcmp(name, "fast") || !strcmp(name, "slow"))
10021022
{
10031023
fprintf(stderr, "Warning: Ignoring deprecated option '%s'.\n", name);
10041024
return;
10051025
}
1026+
/*
1027+
* the following options are only allowed in the options parameter and
1028+
* always require an argument.
1029+
*/
10061030
else if (!strcmp(name, "render"))
10071031
{
10081032
if (nxagentReconnectTrap == True)
@@ -1458,7 +1482,7 @@ void nxagentProcessOptionsFile(char * filename)
14581482
int size;
14591483

14601484
int sizeOfFile;
1461-
int maxFileSize = 1024;
1485+
int maxFileSize = 1024; /* FIXME: why? */
14621486

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

0 commit comments

Comments
 (0)