diff options
author | marha <marha@users.sourceforge.net> | 2009-07-25 19:39:46 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-07-25 19:39:46 +0000 |
commit | 4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (patch) | |
tree | c1e02b9d3509aa97703aa4b540d4cd22ec4600ed /xorg-server/xkb/ddxLoad.c | |
parent | dc3c299dd0995549e2a6973ca0f25b254afd38a5 (diff) | |
download | vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.gz vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.bz2 vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.zip |
Added xorg-server-1.6.2.tar.gz
Diffstat (limited to 'xorg-server/xkb/ddxLoad.c')
-rw-r--r-- | xorg-server/xkb/ddxLoad.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c index 35c3a3d24..4d5dfb685 100644 --- a/xorg-server/xkb/ddxLoad.c +++ b/xorg-server/xkb/ddxLoad.c @@ -48,7 +48,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XI.h> #include "xkb.h" -#if defined(CSRG_BASED) || defined(linux) || defined(__sgi) || defined(AIXV3) || defined(__osf__) || defined(__GNU__) +#if defined(CSRG_BASED) || defined(linux) || defined(__GNU__) #include <paths.h> #endif @@ -126,11 +126,11 @@ Win32System(const char *cmdline) 0, NULL )) { - ErrorF("Starting '%s' failed!\n", cmdline); + ErrorF("[xkb] Starting '%s' failed!\n", cmdline); } else { - ErrorF("Starting '%s' failed: %s", cmdline, (char *)buffer); + ErrorF("[xkb] Starting '%s' failed: %s", cmdline, (char *)buffer); LocalFree(buffer); } @@ -186,61 +186,61 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, char * nameRtrn, int nameRtrnLen) { -FILE * out; -char *buf = NULL, keymap[PATH_MAX],xkm_output_dir[PATH_MAX]; + FILE * out; + char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX]; + + const char *emptystring = ""; + const char *xkbbasedirflag = emptystring; + const char *xkbbindir = emptystring; + const char *xkbbindirsep = emptystring; #ifdef WIN32 -char tmpname[PATH_MAX]; -#endif - if ((names->keymap==NULL)||(names->keymap[0]=='\0')) { - sprintf(keymap,"server-%s",display); - } - else { - if (strlen(names->keymap) > PATH_MAX - 1) { - ErrorF("name of keymap (%s) exceeds max length\n", names->keymap); - return False; - } - strcpy(keymap,names->keymap); - } + /* 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 tmpname[PATH_MAX]; + const char *xkmfile = tmpname; +#else + const char *xkmfile = "-"; +#endif + + snprintf(keymap, sizeof(keymap), "server-%s", display); 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; - - buf = Xprintf( - "\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", - xkbbindir, - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), - xkbbasedir, xkmfile, - PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, - xkm_output_dir,keymap); + + if (XkbBaseDirectory != NULL) { + xkbbasedirflag = Xprintf("\"-R%s\"", XkbBaseDirectory); } - else { -#ifndef WIN32 - char *xkmfile = "-"; -#else - char *xkmfile = tmpname; -#endif - buf = Xprintf( - "xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), - xkmfile, - PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, - xkm_output_dir,keymap); + + if (XkbBinDirectory != NULL) { + int ld = strlen(XkbBinDirectory); + int lps = strlen(PATHSEPARATOR); + + xkbbindir = XkbBinDirectory; + + if ((ld >= lps) && + (strcmp(xkbbindir + ld - lps, PATHSEPARATOR) != 0)) { + xkbbindirsep = PATHSEPARATOR; + } + } + + buf = Xprintf("\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" " + "-em1 %s -emp %s -eml %s \"%s%s.xkm\"", + xkbbindir, xkbbindirsep, + ( (xkbDebugFlags < 2) ? 1 : + ((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ), + xkbbasedirflag, xkmfile, + PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1, + xkm_output_dir, keymap); + + if (xkbbasedirflag != emptystring) { + xfree(xkbbasedirflag); } #ifndef WIN32 @@ -252,7 +252,7 @@ char tmpname[PATH_MAX]; if (out!=NULL) { #ifdef DEBUG if (xkbDebugFlags) { - ErrorF("XkbDDXCompileKeymapByNames compiling keymap:\n"); + ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n"); XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need); } #endif @@ -264,7 +264,7 @@ char tmpname[PATH_MAX]; #endif { if (xkbDebugFlags) - DebugF("xkb executes: %s\n",buf); + DebugF("[xkb] xkb executes: %s\n",buf); if (nameRtrn) { strncpy(nameRtrn,keymap,nameRtrnLen); nameRtrn[nameRtrnLen-1]= '\0'; |