Index: ddxList.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/xkb/ddxList.c,v retrieving revision 1.3 diff -u -r1.3 ddxList.c --- ddxList.c 2 Nov 2004 08:54:53 -0000 1.3 +++ ddxList.c 9 Jan 2005 17:14:49 -0000 @@ -49,6 +49,22 @@ #endif #endif +#ifdef WIN32 +/* from ddxLoad.c */ +extern const char* Win32TempDir(); +extern int Win32System(const char *cmdline); +#undef System +#define System Win32System + +#define W32_tmparg " '%s'" +#define W32_tmpfile ,tmpname +#define W32_tmplen strlen(tmpname)+3 +#else +#define W32_tmparg +#define W32_tmpfile +#define W32_tmplen 0 +#endif + /***====================================================================***/ static char *componentDirs[_XkbListNumComponents] = { @@ -115,14 +131,14 @@ XkbSrvListInfoPtr list, ClientPtr client) { -char *file,*map,*tmp,buf[PATH_MAX]; +char *file,*map,*tmp,buf[PATH_MAX*4]; FILE *in; Status status; int rval; Bool haveDir; #ifdef WIN32 -char tmpname[32]; -#endif +char tmpname[PATH_MAX]; +#endif if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0')) return Success; @@ -141,7 +157,8 @@ in= NULL; haveDir= True; #ifdef WIN32 - strcpy(tmpname, "\\temp\\xkb_XXXXXX"); + strcpy(tmpname, Win32TempDir()); + strcat(tmpname, "\\xkb_XXXXXX"); (void) mktemp(tmpname); #endif if (XkbBaseDirectory!=NULL) { @@ -154,19 +171,15 @@ if (!in) { haveDir= False; if (strlen(XkbBaseDirectory)*2+strlen(componentDirs[what]) - +(xkbDebugFlags>9?2:1)+strlen(file)+31 > PATH_MAX) + +W32_tmplen + +(xkbDebugFlags>9?2:1)+strlen(file)+35 > PATH_MAX) return BadImplementation; -#ifndef WIN32 - sprintf(buf,"%s/xkbcomp -R%s/%s -w %ld -l -vlfhpR '%s'", - XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],(long) - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), - file); -#else - sprintf(buf,"%s/xkbcomp -R%s/%s -w %ld -l -vlfhpR '%s' %s", - XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],(long) + sprintf(buf, + "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg, + XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],(long) ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), - file, tmpname); -#endif + file W32_tmpfile + ); } } else { @@ -178,37 +191,32 @@ } if (!in) { haveDir= False; - if (strlen(componentDirs[what]) + if (strlen(componentDirs[what]) + W32_tmplen +(xkbDebugFlags>9?2:1)+strlen(file)+29 > PATH_MAX) return BadImplementation; -#ifndef WIN32 - sprintf(buf,"xkbcomp -R%s -w %ld -l -vlfhpR '%s'", - componentDirs[what],(long) - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), - file); -#else - sprintf(buf,"xkbcomp -R%s -w %ld -l -vlfhpR '%s' %s", - componentDirs[what],(long) + sprintf(buf, + "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg, + componentDirs[what],(long) ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)), - file, tmpname); -#endif + file W32_tmpfile + ); } } status= Success; if (!haveDir) + { #ifndef WIN32 in= Popen(buf,"r"); #else - { #ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",cmd); + ErrorF("xkb executes: %s\n",buf); #endif if (System(buf) < 0) ErrorF("Could not invoke keymap compiler\n"); else in= fopen(tmpname, "r"); - } #endif + } if (!in) return BadImplementation; list->nFound[what]= 0; @@ -262,6 +270,7 @@ } #else fclose(in); + unlink(tmpname); #endif return status; } Index: ddxLoad.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/xkb/ddxLoad.c,v retrieving revision 1.8 diff -u -r1.8 ddxLoad.c --- ddxLoad.c 9 Jan 2005 15:29:45 -0000 1.8 +++ ddxLoad.c 9 Jan 2005 17:14:49 -0000 @@ -71,7 +71,7 @@ #define POST_ERROR_MSG1 "\"Errors from xkbcomp are not fatal to the X server\"" #define POST_ERROR_MSG2 "\"End of messages from xkbcomp\"" -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined(WIN32) #define PATHSEPARATOR "\\" #else #define PATHSEPARATOR "/" @@ -80,7 +80,7 @@ #ifdef WIN32 #include -static const char* +const char* Win32TempDir() { static char buffer[PATH_MAX]; @@ -102,7 +102,7 @@ return "/tmp"; } -static int +int Win32System(const char *cmdline) { STARTUPINFO si;