aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/xkb/ddxLoad.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/xkb/ddxLoad.c')
-rw-r--r--nx-X11/programs/Xserver/xkb/ddxLoad.c126
1 files changed, 0 insertions, 126 deletions
diff --git a/nx-X11/programs/Xserver/xkb/ddxLoad.c b/nx-X11/programs/Xserver/xkb/ddxLoad.c
index bff69196f..8529985a3 100644
--- a/nx-X11/programs/Xserver/xkb/ddxLoad.c
+++ b/nx-X11/programs/Xserver/xkb/ddxLoad.c
@@ -74,109 +74,20 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define POST_ERROR_MSG1 "\"Errors from xkbcomp are not fatal to the X server\""
#define POST_ERROR_MSG2 "\"End of messages from xkbcomp\""
-#if defined(WIN32)
-#define PATHSEPARATOR "\\"
-#else
#define PATHSEPARATOR "/"
-#endif
-
-#ifdef WIN32
-
-#include <nx-X11/Xwindows.h>
-const char*
-Win32TempDir()
-{
- static char buffer[PATH_MAX];
- if (GetTempPath(sizeof(buffer), buffer))
- {
- int len;
- buffer[sizeof(buffer)-1] = 0;
- len = strlen(buffer);
- if (len > 0)
- if (buffer[len-1] == '\\')
- buffer[len-1] = 0;
- return buffer;
- }
- if (getenv("TEMP") != NULL)
- return getenv("TEMP");
- else if (getenv("TMP") != NULL)
- return getenv("TEMP");
- else
- return "/tmp";
-}
-
-int
-Win32System(const char *cmdline)
-{
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- DWORD dwExitCode;
- char *cmd = xstrdup(cmdline);
- ZeroMemory( &si, sizeof(si) );
- si.cb = sizeof(si);
- ZeroMemory( &pi, sizeof(pi) );
-
- if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
- {
- LPVOID buffer;
- if (!FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buffer,
- 0,
- NULL ))
- {
- ErrorF("Starting '%s' failed!\n", cmdline);
- }
- else
- {
- ErrorF("Starting '%s' failed: %s", cmdline, (char *)buffer);
- LocalFree(buffer);
- }
-
- free(cmd);
- return -1;
- }
- /* Wait until child process exits. */
- WaitForSingleObject( pi.hProcess, INFINITE );
-
- GetExitCodeProcess( pi.hProcess, &dwExitCode);
-
- /* Close process and thread handles. */
- CloseHandle( pi.hProcess );
- CloseHandle( pi.hThread );
- free(cmd);
-
- return dwExitCode;
-}
-#undef System
-#define System(x) Win32System(x)
-#endif
static void
OutputDirectory(
char* outdir,
size_t size)
{
-#ifndef WIN32
if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size))
{
/* if server running as root it *may* be able to write */
/* FIXME: check whether directory is writable at all */
(void) strcpy (outdir, XKM_OUTPUT_DIR);
} else
-#else
- if (strlen(Win32TempDir()) + 1 < size)
- {
- (void) strcpy(outdir, Win32TempDir());
- (void) strcat(outdir, "\\");
- } else
-#endif
if (strlen("/tmp/") < size)
{
(void) strcpy (outdir, "/tmp/");
@@ -265,9 +176,6 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
FILE * out;
char *buf = NULL, keymap[PATH_MAX],xkm_output_dir[PATH_MAX];
-#ifdef WIN32
-char tmpname[PATH_MAX];
-#endif
if ((names->keymap==NULL)||(names->keymap[0]=='\0')) {
sprintf(keymap,"server-%s",display);
}
@@ -281,20 +189,9 @@ char tmpname[PATH_MAX];
XkbEnsureSafeMapName(keymap);
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
-#ifdef WIN32
- strcpy(tmpname, Win32TempDir());
- strcat(tmpname, "\\xkb_XXXXXX");
- (void) mktemp(tmpname);
-#endif
if (XkbBaseDirectory!=NULL) {
-#ifndef WIN32
char *xkmfile = "-";
-#else
- /* WIN32 has no popen. The input must be stored in a file which is used as input
- for xkbcomp. xkbcomp does not read from stdin. */
- char *xkmfile = tmpname;
-#endif
char *xkbbasedir = XkbBaseDirectory;
char *xkbbindir = XkbBinDirectory;
@@ -308,11 +205,7 @@ char tmpname[PATH_MAX];
buf = NULL;
}
else {
-#ifndef WIN32
char *xkmfile = "-";
-#else
- char *xkmfile = tmpname;
-#endif
if (asprintf(&buf,
"xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
@@ -331,11 +224,7 @@ char tmpname[PATH_MAX];
"Callin Popen() with null command.\n");
#endif
-#ifndef WIN32
out= Popen(buf,"w");
-#else
- out= fopen(tmpname, "w");
-#endif
if (out!=NULL) {
#ifdef DEBUG
@@ -345,7 +234,6 @@ char tmpname[PATH_MAX];
}
#endif
XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need);
-#ifndef WIN32
#ifdef __sun
if (Pclose(out) != 0)
{
@@ -355,9 +243,6 @@ char tmpname[PATH_MAX];
#else
if (Pclose(out)==0)
#endif
-#else
- if (fclose(out)==0 && System(buf) >= 0)
-#endif
{
if (xkbDebugFlags)
DebugF("xkb executes: %s\n",buf);
@@ -371,17 +256,9 @@ char tmpname[PATH_MAX];
}
else
DebugF("Error compiling keymap (%s)\n",keymap);
-#ifdef WIN32
- /* remove the temporary file */
- unlink(tmpname);
-#endif
}
else {
-#ifndef WIN32
DebugF("Could not invoke keymap compiler\n");
-#else
- DebugF("Could not open file %s\n", tmpname);
-#endif
}
if (nameRtrn)
nameRtrn[0]= '\0';
@@ -400,9 +277,6 @@ FILE * file;
if (mapName!=NULL) {
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
if ((XkbBaseDirectory!=NULL)&&(xkm_output_dir[0]!='/')
-#ifdef WIN32
- &&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':')
-#endif
) {
if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory,
xkm_output_dir, mapName) >= PATH_MAX)