summaryrefslogtreecommitdiff
path: root/xkb/ddxLoad.c
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-11-15 18:13:41 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-11-15 18:13:41 +0000
commite6bc551e3451efe4fcbb55475d6d0ff53fcc9807 (patch)
tree667d604ea60a01a4ea3b4019d78ff5e04f2bd51c /xkb/ddxLoad.c
parent6618567311f41f5e237f12b4204aa32ce174a514 (diff)
Use CreateProcess instead of system() to spawn xkbcomp on windows. system()
can not handle spaces in the path component. Quoted all filenames on the commandline.
Diffstat (limited to 'xkb/ddxLoad.c')
-rw-r--r--xkb/ddxLoad.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index f346afd78..f0b942322 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -72,6 +72,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define POST_ERROR_MSG2 "\"End of messages from xkbcomp\""
#ifdef WIN32
+
+#include <Xwindows.h>
static const char*
Win32TempDir()
{
@@ -82,6 +84,38 @@ Win32TempDir()
else
return "/tmp";
}
+
+static 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))
+ {
+ xfree(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 );
+ xfree(cmd);
+
+ return dwExitCode;
+}
+#undef System
+#define System(x) Win32System(x)
#endif
static void
@@ -284,12 +318,10 @@ int i;
#endif
#else
sprintf(buf,
- "%s/xkbcomp -w %d -R%s -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\" < %s",
+ "\"%s\\xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" \"%s%s.xkm\"",
XkbBaseDirectory,
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
- XkbBaseDirectory,
- PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
- xkm_output_dir,keymap,tmpname);
+ XkbBaseDirectory, tmpname, xkm_output_dir,keymap);
#endif
}
else {