aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-01-02 23:17:04 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-01-05 21:44:12 +0100
commit925f58992064b41019c24fa012fa4cd88eb513fd (patch)
treef0a90e17f807f625c6e08ef4990e82f57e01d857 /nx-X11/programs
parentee3afe303fc35b98e5f674efc91fdeb2183dfcb5 (diff)
downloadnx-libs-925f58992064b41019c24fa012fa4cd88eb513fd.tar.gz
nx-libs-925f58992064b41019c24fa012fa4cd88eb513fd.tar.bz2
nx-libs-925f58992064b41019c24fa012fa4cd88eb513fd.zip
Args.c: do not parse nx/nx marker as option
slight optimization
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index 1bfec1798..155f40f66 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -1528,6 +1528,30 @@ static void nxagentParseOptionString(char *string)
SAFE_free(dup);
}
+char *nxagentSkipNXMarker(char *string)
+{
+ if (strncasecmp(string, "nx/nx,", 6) == 0 ||
+ strncasecmp(string, "nx/nx:", 6) == 0)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "%s: skipping [%6.6s]\n", __func__, string);
+ #endif
+ return string + 6;
+ }
+ else if (strncasecmp(string, "nx,", 3) == 0 ||
+ strncasecmp(string, "nx:", 3) == 0)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "%s: skipping [%3.3s]\n", __func__, string);
+ #endif
+ return string + 3;
+ }
+ else
+ {
+ return string;
+ }
+}
+
void nxagentProcessOptions(char * string)
{
if (!string)
@@ -1540,15 +1564,10 @@ void nxagentProcessOptions(char * string)
/* if the "filename" starts with an nx marker treat it
as an option _string_ instead of a filename */
- if (strncasecmp(string, "nx/nx,", 6) == 0 ||
- strncasecmp(string, "nx/nx:", 6) == 0)
+ char *skipped = nxagentSkipNXMarker(string);
+ if (skipped != string)
{
- nxagentParseOptionString(string + 6);
- }
- else if (strncasecmp(string, "nx,", 3) == 0 ||
- strncasecmp(string, "nx:", 3) == 0)
- {
- nxagentParseOptionString(string + 3);
+ nxagentParseOptionString(skipped);
}
else
{
@@ -1659,7 +1678,11 @@ void nxagentProcessOptionsFile(char * filename)
data[offset] = '\0';
- nxagentParseOptionString(data);
+ #ifdef DEBUG
+ fprintf(stderr, "%s: first line of options file [%s]\n", __func__, data);
+ #endif
+
+ nxagentParseOptionString(nxagentSkipNXMarker(data));
nxagentProcessOptionsFileExit: