aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Args.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-07-11 21:29:59 +0200
committerUlrich Sibiller <uli42@gmx.de>2017-07-23 02:22:39 +0200
commitb007b542df5cf6388340a81ad812473dcf8c616d (patch)
tree6b4edbdf855b653739c4d1c016eaf1690e96867b /nx-X11/programs/Xserver/hw/nxagent/Args.c
parent4ccb7eda5563ce7594245eb70aab6754e7b104c2 (diff)
downloadnx-libs-b007b542df5cf6388340a81ad812473dcf8c616d.tar.gz
nx-libs-b007b542df5cf6388340a81ad812473dcf8c616d.tar.bz2
nx-libs-b007b542df5cf6388340a81ad812473dcf8c616d.zip
pass filename as parameter to nxagentProcessOptionsFile()
Do not use global variables where it is not necessary.
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Args.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index 5c908e80b..cc9ec8523 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -1569,7 +1569,7 @@ static void nxagentParseOptionString(char *string)
}
}
-void nxagentProcessOptionsFile()
+void nxagentProcessOptionsFile(char * filename)
{
FILE *file;
char *data;
@@ -1581,8 +1581,8 @@ void nxagentProcessOptionsFile()
int maxFileSize = 1024;
#ifdef DEBUG
- fprintf(stderr, "nxagentProcessOptionsFile: Going to process option the file [%s].\n",
- validateString(nxagentOptionFile));
+ fprintf(stderr, "nxagentProcessOptionsFile: Going to process option file [%s].\n",
+ validateString(filename);
#endif
/*
@@ -1590,15 +1590,15 @@ void nxagentProcessOptionsFile()
*/
setStatePath("");
- if (nxagentOptionFile == NULL)
+ if (filename == NULL)
{
return;
}
- if ((file = fopen(nxagentOptionFile, "r")) == NULL)
+ if ((file = fopen(filename, "r")) == NULL)
{
fprintf(stderr, "Warning: Couldn't open option file '%s'. Error is '%s'.\n",
- validateString(nxagentOptionFile), strerror(errno));
+ validateString(filename), strerror(errno));
goto nxagentProcessOptionsFileExit;
}
@@ -1606,7 +1606,7 @@ void nxagentProcessOptionsFile()
if (fseek(file, 0, SEEK_END) != 0)
{
fprintf(stderr, "Warning: Couldn't position inside option file '%s'. Error is '%s'.\n",
- validateString(nxagentOptionFile), strerror(errno));
+ validateString(filename), strerror(errno));
goto nxagentProcessOptionsFileClose;
}
@@ -1614,14 +1614,14 @@ void nxagentProcessOptionsFile()
if ((sizeOfFile = ftell(file)) == -1)
{
fprintf(stderr, "Warning: Couldn't get the size of option file '%s'. Error is '%s'.\n",
- validateString(nxagentOptionFile), strerror(errno));
+ validateString(filename), strerror(errno));
goto nxagentProcessOptionsFileClose;
}
#ifdef DEBUG
fprintf(stderr, "nxagentProcessOptionsFile: Processing option file [%s].\n",
- validateString(nxagentOptionFile));
+ validateString(filename));
#endif
rewind(file);
@@ -1629,7 +1629,7 @@ void nxagentProcessOptionsFile()
if (sizeOfFile > maxFileSize)
{
fprintf(stderr, "Warning: Maximum file size exceeded for options '%s'.\n",
- validateString(nxagentOptionFile));
+ validateString(filename));
goto nxagentProcessOptionsFileClose;
}
@@ -1637,7 +1637,7 @@ void nxagentProcessOptionsFile()
if ((data = malloc(sizeOfFile + 1)) == NULL)
{
fprintf(stderr, "Warning: Memory allocation failed processing file '%s'.\n",
- validateString(nxagentOptionFile));
+ validateString(filename));
goto nxagentProcessOptionsFileClose;
}
@@ -1652,7 +1652,7 @@ void nxagentProcessOptionsFile()
if (ferror(file) != 0)
{
fprintf(stderr, "Warning: Error reading the option file '%s'.\n",
- validateString(nxagentOptionFile));
+ validateString(filename));
goto nxagentProcessOptionsFileFree;
}
@@ -1669,7 +1669,7 @@ void nxagentProcessOptionsFile()
if (size != sizeOfFile)
{
fprintf(stderr, "Warning: Premature end of option file '%s' while reading.\n",
- validateString(nxagentOptionFile));
+ validateString(filename));
goto nxagentProcessOptionsFileFree;
}
@@ -1696,7 +1696,7 @@ nxagentProcessOptionsFileClose:
if (fclose(file) != 0)
{
fprintf(stderr, "Warning: Couldn't close option file '%s'. Error is '%s'.\n",
- validateString(nxagentOptionFile), strerror(errno));
+ validateString(filename), strerror(errno));
}
nxagentProcessOptionsFileExit: