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
6957b3da
Commit
6957b3da
authored
Oct 13, 2016
by
Ulrich Sibiller
Committed by
Mike Gabriel
Nov 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move helper functions to file end
this simplyfies updating to Xorg/xtrans upstream
parent
f686bc3e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
148 additions
and
142 deletions
+148
-142
Xtranssock.c
nx-X11/lib/xtrans/Xtranssock.c
+148
-142
No files found.
nx-X11/lib/xtrans/Xtranssock.c
View file @
6957b3da
...
...
@@ -307,148 +307,8 @@ static _NXProxyConnInfo *_NXProxyConnInfoTab[NX_PROXY_CONN_LIMIT];
#endif
/* #ifdef TRANS_CLIENT */
/*
* Override the UNIX_DIR and UNIX_PATH settings and
* make them configurable, based on the NX_TEMP or
* the TEMP environment.
*
* We must be careful as the same defines are used
* for different directories, based on the subsystem
* that is compiling this, while we want to override
* only the '/tmp/.X11-unix' and '/tmp/.X11-unix/X'
* settings.
*/
static
char
_NXUnixDir
[
1024
];
static
char
_NXUnixPath
[
1024
];
static
char
*
_NXGetUnixDir
(
char
*
dir
)
{
const
char
*
tempDir
;
PRMSG
(
3
,
"_NXGetUnixDir(%s)
\n
"
,
dir
,
0
,
0
);
if
(
strcmp
(
dir
,
UNIX_DIR
)
!=
0
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Returning other Unix directory [%s].
\n
"
,
dir
);
#endif
return
dir
;
}
/*
* Check the environment only once.
*/
if
(
*
_NXUnixDir
!=
'\0'
)
{
return
_NXUnixDir
;
}
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Trying with the NX_TEMP environment.
\n
"
);
#endif
tempDir
=
getenv
(
"NX_TEMP"
);
if
(
tempDir
==
NULL
||
*
tempDir
==
'\0'
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Trying with the TEMP environment.
\n
"
);
#endif
tempDir
=
getenv
(
"TEMP"
);
}
if
(
tempDir
!=
NULL
&&
*
tempDir
!=
'\0'
)
{
if
(
strlen
(
tempDir
)
+
strlen
(
"/.X11-unix"
)
+
1
>
1024
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: WARNING! Maximum length of X11 Unix directory exceeded.
\n
"
);
#endif
goto
_NXGetUnixDirError
;
}
strcpy
(
_NXUnixDir
,
tempDir
);
strcat
(
_NXUnixDir
,
"/.X11-unix"
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Using X11 Unix directory [%s].
\n
"
,
_NXUnixDir
);
#endif
return
_NXUnixDir
;
}
_NXGetUnixDirError:
strcpy
(
_NXUnixDir
,
dir
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Returning default X11 Unix directory [%s].
\n
"
,
_NXUnixDir
);
#endif
return
_NXUnixDir
;
}
static
char
*
_NXGetUnixPath
(
char
*
path
)
{
const
char
*
unixDir
;
PRMSG
(
3
,
"_NXGetUnixPath(%s)
\n
"
,
path
,
0
,
0
);
if
(
strcmp
(
path
,
UNIX_PATH
)
!=
0
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: Returning other X11 Unix path [%s].
\n
"
,
path
);
#endif
return
path
;
}
/*
* Check the environment only once.
*/
if
(
*
_NXUnixPath
!=
'\0'
)
{
return
_NXUnixPath
;
}
unixDir
=
_NXGetUnixDir
(
UNIX_DIR
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: Got X11 Unix directory [%s].
\n
"
,
unixDir
);
#endif
if
(
strlen
(
unixDir
)
+
strlen
(
"/X"
)
+
1
>
1024
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: WARNING! Maximum length of X11 Unix path exceeded.
\n
"
);
#endif
goto
_NXGetUnixPathError
;
}
strcpy
(
_NXUnixPath
,
unixDir
);
strcat
(
_NXUnixPath
,
"/X"
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: Returning X11 Unix path [%s].
\n
"
,
_NXUnixPath
);
#endif
return
_NXUnixPath
;
_NXGetUnixPathError:
strcpy
(
_NXUnixPath
,
path
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: Returning default X11 Unix path [%s].
\n
"
,
_NXUnixPath
);
#endif
return
_NXUnixPath
;
}
static
char
*
_NXGetUnixDir
(
char
*
dir
);
static
char
*
_NXGetUnixPath
(
char
*
path
);
/*
* Forcibly close any connection attempt on the
...
...
@@ -3353,3 +3213,149 @@ Xtransport TRANS(SocketUNIXFuncs) = {
};
#endif
/* UNIXCONN */
#ifdef NX_TRANS_SOCKET
/*
* Override the UNIX_DIR and UNIX_PATH settings and
* make them configurable, based on the NX_TEMP or
* the TEMP environment.
*
* We must be careful as the same defines are used
* for different directories, based on the subsystem
* that is compiling this, while we want to override
* only the '/tmp/.X11-unix' and '/tmp/.X11-unix/X'
* settings.
*/
static
char
_NXUnixDir
[
1024
];
static
char
_NXUnixPath
[
1024
];
static
char
*
_NXGetUnixDir
(
char
*
dir
)
{
const
char
*
tempDir
;
PRMSG
(
3
,
"_NXGetUnixDir(%s)
\n
"
,
dir
,
0
,
0
);
if
(
strcmp
(
dir
,
UNIX_DIR
)
!=
0
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Returning other Unix directory [%s].
\n
"
,
dir
);
#endif
return
dir
;
}
/*
* Check the environment only once.
*/
if
(
*
_NXUnixDir
!=
'\0'
)
{
return
_NXUnixDir
;
}
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Trying with the NX_TEMP environment.
\n
"
);
#endif
tempDir
=
getenv
(
"NX_TEMP"
);
if
(
tempDir
==
NULL
||
*
tempDir
==
'\0'
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Trying with the TEMP environment.
\n
"
);
#endif
tempDir
=
getenv
(
"TEMP"
);
}
if
(
tempDir
!=
NULL
&&
*
tempDir
!=
'\0'
)
{
if
(
strlen
(
tempDir
)
+
strlen
(
"/.X11-unix"
)
+
1
>
1024
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: WARNING! Maximum length of X11 Unix directory exceeded.
\n
"
);
#endif
goto
_NXGetUnixDirError
;
}
strcpy
(
_NXUnixDir
,
tempDir
);
strcat
(
_NXUnixDir
,
"/.X11-unix"
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Using X11 Unix directory [%s].
\n
"
,
_NXUnixDir
);
#endif
return
_NXUnixDir
;
}
_NXGetUnixDirError:
strcpy
(
_NXUnixDir
,
dir
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixDir: Returning default X11 Unix directory [%s].
\n
"
,
_NXUnixDir
);
#endif
return
_NXUnixDir
;
}
static
char
*
_NXGetUnixPath
(
char
*
path
)
{
const
char
*
unixDir
;
PRMSG
(
3
,
"_NXGetUnixPath(%s)
\n
"
,
path
,
0
,
0
);
if
(
strcmp
(
path
,
UNIX_PATH
)
!=
0
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: Returning other X11 Unix path [%s].
\n
"
,
path
);
#endif
return
path
;
}
/*
* Check the environment only once.
*/
if
(
*
_NXUnixPath
!=
'\0'
)
{
return
_NXUnixPath
;
}
unixDir
=
_NXGetUnixDir
(
UNIX_DIR
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: Got X11 Unix directory [%s].
\n
"
,
unixDir
);
#endif
if
(
strlen
(
unixDir
)
+
strlen
(
"/X"
)
+
1
>
1024
)
{
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: WARNING! Maximum length of X11 Unix path exceeded.
\n
"
);
#endif
goto
_NXGetUnixPathError
;
}
strcpy
(
_NXUnixPath
,
unixDir
);
strcat
(
_NXUnixPath
,
"/X"
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: Returning X11 Unix path [%s].
\n
"
,
_NXUnixPath
);
#endif
return
_NXUnixPath
;
_NXGetUnixPathError:
strcpy
(
_NXUnixPath
,
path
);
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetUnixPath: Returning default X11 Unix path [%s].
\n
"
,
_NXUnixPath
);
#endif
return
_NXUnixPath
;
}
#endif
/* NX_TRANS_SOCKET */
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