aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/xkb
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2024-05-05 20:39:23 +0200
committerUlrich Sibiller <uli42@gmx.de>2024-05-11 18:56:10 +0200
commit0670f7583d63977cb175ffe11a64061f88c1bf31 (patch)
tree70ba0a42e02e86da7d3a4ff726dd910150cf7986 /nx-X11/programs/Xserver/xkb
parent270a98bafedfbdfb8089361e8f2cb13903a1c4be (diff)
downloadnx-libs-0670f7583d63977cb175ffe11a64061f88c1bf31.tar.gz
nx-libs-0670f7583d63977cb175ffe11a64061f88c1bf31.tar.bz2
nx-libs-0670f7583d63977cb175ffe11a64061f88c1bf31.zip
Xext,os,xkb: repeat unifdefs
there where remnants of WIN32, CYGWIN and SCO
Diffstat (limited to 'nx-X11/programs/Xserver/xkb')
-rw-r--r--nx-X11/programs/Xserver/xkb/ddxList.c37
-rw-r--r--nx-X11/programs/Xserver/xkb/ddxLoad.c126
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbAccessX.c2
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbInit.c2
4 files changed, 0 insertions, 167 deletions
diff --git a/nx-X11/programs/Xserver/xkb/ddxList.c b/nx-X11/programs/Xserver/xkb/ddxList.c
index ee5d63fac..28f3e0fd5 100644
--- a/nx-X11/programs/Xserver/xkb/ddxList.c
+++ b/nx-X11/programs/Xserver/xkb/ddxList.c
@@ -41,21 +41,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <xkbsrv.h>
#include <nx-X11/extensions/XI.h>
-#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
/***====================================================================***/
@@ -127,9 +115,6 @@ FILE *in;
Status status;
int rval;
Bool haveDir;
-#ifdef WIN32
-char tmpname[PATH_MAX];
-#endif
if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0'))
return Success;
@@ -146,11 +131,6 @@ char tmpname[PATH_MAX];
in= NULL;
haveDir= True;
-#ifdef WIN32
- strcpy(tmpname, Win32TempDir());
- strcat(tmpname, "\\xkb_XXXXXX");
- (void) mktemp(tmpname);
-#endif
if (XkbBaseDirectory!=NULL) {
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
@@ -198,23 +178,11 @@ char tmpname[PATH_MAX];
status= Success;
if (!haveDir)
{
-#ifndef WIN32
in= Popen(buf,"r");
-#else
- if (xkbDebugFlags)
- DebugF("xkb executes: %s\n",buf);
- if (System(buf) < 0)
- ErrorF("Could not invoke keymap compiler\n");
- else
- in= fopen(tmpname, "r");
-#endif
}
if (!in)
{
free (buf);
-#ifdef WIN32
- unlink(tmpname);
-#endif
return BadImplementation;
}
list->nFound[what]= 0;
@@ -266,17 +234,12 @@ char tmpname[PATH_MAX];
}
status= _AddListComponent(list,what,flags,tmp,client);
}
-#ifndef WIN32
if (haveDir)
fclose(in);
else if ((rval=Pclose(in))!=0) {
if (xkbDebugFlags)
ErrorF("xkbcomp returned exit code %d\n",rval);
}
-#else
- fclose(in);
- unlink(tmpname);
-#endif
free (buf);
return status;
}
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)
diff --git a/nx-X11/programs/Xserver/xkb/xkbAccessX.c b/nx-X11/programs/Xserver/xkb/xkbAccessX.c
index 3eafaa5b7..d9909aa87 100644
--- a/nx-X11/programs/Xserver/xkb/xkbAccessX.c
+++ b/nx-X11/programs/Xserver/xkb/xkbAccessX.c
@@ -35,9 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <nx-X11/keysym.h>
#include "inputstr.h"
#include <xkbsrv.h>
-#if !defined(WIN32)
#include <sys/time.h>
-#endif
int XkbDfltRepeatDelay= 660;
int XkbDfltRepeatInterval= 40;
diff --git a/nx-X11/programs/Xserver/xkb/xkbInit.c b/nx-X11/programs/Xserver/xkb/xkbInit.c
index f37e202d8..63686506e 100644
--- a/nx-X11/programs/Xserver/xkb/xkbInit.c
+++ b/nx-X11/programs/Xserver/xkb/xkbInit.c
@@ -834,12 +834,10 @@ XkbProcessArguments(int argc,char *argv[],int i)
}
else if (strncmp(argv[i], "-xkbdir", 7) == 0) {
if(++i < argc) {
-#if !defined(WIN32) && !defined(__CYGWIN__)
if (getuid() != geteuid()) {
LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n");
return -1;
} else
-#endif
{
if (strlen(argv[i]) < PATH_MAX) {
XkbBaseDirectory= argv[i];