Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
b007b542
Commit
b007b542
authored
Jul 11, 2017
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pass filename as parameter to nxagentProcessOptionsFile()
Do not use global variables where it is not necessary.
parent
4ccb7eda
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
16 deletions
+18
-16
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+14
-14
Args.h
nx-X11/programs/Xserver/hw/nxagent/Args.h
+1
-1
Reconnect.c
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+3
-1
No files found.
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
b007b542
...
@@ -1569,7 +1569,7 @@ static void nxagentParseOptionString(char *string)
...
@@ -1569,7 +1569,7 @@ static void nxagentParseOptionString(char *string)
}
}
}
}
void
nxagentProcessOptionsFile
()
void
nxagentProcessOptionsFile
(
char
*
filename
)
{
{
FILE
*
file
;
FILE
*
file
;
char
*
data
;
char
*
data
;
...
@@ -1581,8 +1581,8 @@ void nxagentProcessOptionsFile()
...
@@ -1581,8 +1581,8 @@ void nxagentProcessOptionsFile()
int
maxFileSize
=
1024
;
int
maxFileSize
=
1024
;
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentProcessOptionsFile: Going to process option
the
file [%s].
\n
"
,
fprintf
(
stderr
,
"nxagentProcessOptionsFile: Going to process option file [%s].
\n
"
,
validateString
(
nxagentOptionFile
)
);
validateString
(
filename
);
#endif
#endif
/*
/*
...
@@ -1590,15 +1590,15 @@ void nxagentProcessOptionsFile()
...
@@ -1590,15 +1590,15 @@ void nxagentProcessOptionsFile()
*/
*/
setStatePath
(
""
);
setStatePath
(
""
);
if
(
nxagentOptionFil
e
==
NULL
)
if
(
filenam
e
==
NULL
)
{
{
return
;
return
;
}
}
if
((
file
=
fopen
(
nxagentOptionFil
e
,
"r"
))
==
NULL
)
if
((
file
=
fopen
(
filenam
e
,
"r"
))
==
NULL
)
{
{
fprintf
(
stderr
,
"Warning: Couldn't open option file '%s'. Error is '%s'.
\n
"
,
fprintf
(
stderr
,
"Warning: Couldn't open option file '%s'. Error is '%s'.
\n
"
,
validateString
(
nxagentOptionFil
e
),
strerror
(
errno
));
validateString
(
filenam
e
),
strerror
(
errno
));
goto
nxagentProcessOptionsFileExit
;
goto
nxagentProcessOptionsFileExit
;
}
}
...
@@ -1606,7 +1606,7 @@ void nxagentProcessOptionsFile()
...
@@ -1606,7 +1606,7 @@ void nxagentProcessOptionsFile()
if
(
fseek
(
file
,
0
,
SEEK_END
)
!=
0
)
if
(
fseek
(
file
,
0
,
SEEK_END
)
!=
0
)
{
{
fprintf
(
stderr
,
"Warning: Couldn't position inside option file '%s'. Error is '%s'.
\n
"
,
fprintf
(
stderr
,
"Warning: Couldn't position inside option file '%s'. Error is '%s'.
\n
"
,
validateString
(
nxagentOptionFil
e
),
strerror
(
errno
));
validateString
(
filenam
e
),
strerror
(
errno
));
goto
nxagentProcessOptionsFileClose
;
goto
nxagentProcessOptionsFileClose
;
}
}
...
@@ -1614,14 +1614,14 @@ void nxagentProcessOptionsFile()
...
@@ -1614,14 +1614,14 @@ void nxagentProcessOptionsFile()
if
((
sizeOfFile
=
ftell
(
file
))
==
-
1
)
if
((
sizeOfFile
=
ftell
(
file
))
==
-
1
)
{
{
fprintf
(
stderr
,
"Warning: Couldn't get the size of option file '%s'. Error is '%s'.
\n
"
,
fprintf
(
stderr
,
"Warning: Couldn't get the size of option file '%s'. Error is '%s'.
\n
"
,
validateString
(
nxagentOptionFil
e
),
strerror
(
errno
));
validateString
(
filenam
e
),
strerror
(
errno
));
goto
nxagentProcessOptionsFileClose
;
goto
nxagentProcessOptionsFileClose
;
}
}
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"nxagentProcessOptionsFile: Processing option file [%s].
\n
"
,
fprintf
(
stderr
,
"nxagentProcessOptionsFile: Processing option file [%s].
\n
"
,
validateString
(
nxagentOptionFil
e
));
validateString
(
filenam
e
));
#endif
#endif
rewind
(
file
);
rewind
(
file
);
...
@@ -1629,7 +1629,7 @@ void nxagentProcessOptionsFile()
...
@@ -1629,7 +1629,7 @@ void nxagentProcessOptionsFile()
if
(
sizeOfFile
>
maxFileSize
)
if
(
sizeOfFile
>
maxFileSize
)
{
{
fprintf
(
stderr
,
"Warning: Maximum file size exceeded for options '%s'.
\n
"
,
fprintf
(
stderr
,
"Warning: Maximum file size exceeded for options '%s'.
\n
"
,
validateString
(
nxagentOptionFil
e
));
validateString
(
filenam
e
));
goto
nxagentProcessOptionsFileClose
;
goto
nxagentProcessOptionsFileClose
;
}
}
...
@@ -1637,7 +1637,7 @@ void nxagentProcessOptionsFile()
...
@@ -1637,7 +1637,7 @@ void nxagentProcessOptionsFile()
if
((
data
=
malloc
(
sizeOfFile
+
1
))
==
NULL
)
if
((
data
=
malloc
(
sizeOfFile
+
1
))
==
NULL
)
{
{
fprintf
(
stderr
,
"Warning: Memory allocation failed processing file '%s'.
\n
"
,
fprintf
(
stderr
,
"Warning: Memory allocation failed processing file '%s'.
\n
"
,
validateString
(
nxagentOptionFil
e
));
validateString
(
filenam
e
));
goto
nxagentProcessOptionsFileClose
;
goto
nxagentProcessOptionsFileClose
;
}
}
...
@@ -1652,7 +1652,7 @@ void nxagentProcessOptionsFile()
...
@@ -1652,7 +1652,7 @@ void nxagentProcessOptionsFile()
if
(
ferror
(
file
)
!=
0
)
if
(
ferror
(
file
)
!=
0
)
{
{
fprintf
(
stderr
,
"Warning: Error reading the option file '%s'.
\n
"
,
fprintf
(
stderr
,
"Warning: Error reading the option file '%s'.
\n
"
,
validateString
(
nxagentOptionFil
e
));
validateString
(
filenam
e
));
goto
nxagentProcessOptionsFileFree
;
goto
nxagentProcessOptionsFileFree
;
}
}
...
@@ -1669,7 +1669,7 @@ void nxagentProcessOptionsFile()
...
@@ -1669,7 +1669,7 @@ void nxagentProcessOptionsFile()
if
(
size
!=
sizeOfFile
)
if
(
size
!=
sizeOfFile
)
{
{
fprintf
(
stderr
,
"Warning: Premature end of option file '%s' while reading.
\n
"
,
fprintf
(
stderr
,
"Warning: Premature end of option file '%s' while reading.
\n
"
,
validateString
(
nxagentOptionFil
e
));
validateString
(
filenam
e
));
goto
nxagentProcessOptionsFileFree
;
goto
nxagentProcessOptionsFileFree
;
}
}
...
@@ -1696,7 +1696,7 @@ nxagentProcessOptionsFileClose:
...
@@ -1696,7 +1696,7 @@ nxagentProcessOptionsFileClose:
if
(
fclose
(
file
)
!=
0
)
if
(
fclose
(
file
)
!=
0
)
{
{
fprintf
(
stderr
,
"Warning: Couldn't close option file '%s'. Error is '%s'.
\n
"
,
fprintf
(
stderr
,
"Warning: Couldn't close option file '%s'. Error is '%s'.
\n
"
,
validateString
(
nxagentOptionFil
e
),
strerror
(
errno
));
validateString
(
filenam
e
),
strerror
(
errno
));
}
}
nxagentProcessOptionsFileExit:
nxagentProcessOptionsFileExit:
...
...
nx-X11/programs/Xserver/hw/nxagent/Args.h
View file @
b007b542
...
@@ -81,7 +81,7 @@ extern Bool nxagentIpaq;
...
@@ -81,7 +81,7 @@ extern Bool nxagentIpaq;
extern
int
nxagentLockDeferLevel
;
extern
int
nxagentLockDeferLevel
;
Bool
nxagentPostProcessArgs
(
char
*
name
,
Display
*
dpy
,
Screen
*
scr
);
Bool
nxagentPostProcessArgs
(
char
*
name
,
Display
*
dpy
,
Screen
*
scr
);
void
nxagentProcessOptionsFile
(
void
);
void
nxagentProcessOptionsFile
(
char
*
filename
);
void
nxagentSetPackMethod
(
void
);
void
nxagentSetPackMethod
(
void
);
void
nxagentSetDeferLevel
(
void
);
void
nxagentSetDeferLevel
(
void
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
View file @
b007b542
...
@@ -103,6 +103,8 @@ extern Bool nxagentRenderEnable;
...
@@ -103,6 +103,8 @@ extern Bool nxagentRenderEnable;
extern
char
*
nxagentKeyboard
;
extern
char
*
nxagentKeyboard
;
extern
char
*
nxagentOptionFile
;
enum
SESSION_STATE
nxagentSessionState
=
SESSION_STARTING
;
enum
SESSION_STATE
nxagentSessionState
=
SESSION_STARTING
;
struct
nxagentExceptionStruct
nxagentException
=
{
0
,
0
};
struct
nxagentExceptionStruct
nxagentException
=
{
0
,
0
};
...
@@ -454,7 +456,7 @@ Bool nxagentReconnectSession(void)
...
@@ -454,7 +456,7 @@ Bool nxagentReconnectSession(void)
nxagentResetOptions
();
nxagentResetOptions
();
nxagentProcessOptionsFile
();
nxagentProcessOptionsFile
(
nxagentOptionFile
);
if
(
nxagentReconnectDisplay
(
reconnectLossyLevel
[
DISPLAY_STEP
])
==
0
)
if
(
nxagentReconnectDisplay
(
reconnectLossyLevel
[
DISPLAY_STEP
])
==
0
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment