From 5e6e99eaef3ca346c78a3e520ed58ec8b8100b41 Mon Sep 17 00:00:00 2001
From: Adam Tkac <atkac@redhat.com>
Date: Thu, 2 Sep 2010 17:24:38 +0200
Subject: [PATCH] Add -xkbcompdir parameter to modify "xkbcomp" path from commandline.

Signed-off-by: Adam Tkac <atkac@redhat.com>
---
 xkb/xkbInit.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index fbf8f14..29fb33e 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -742,7 +742,28 @@ XkbProcessArguments(int argc,char *argv[],int i)
             }
         }
         return j;
+    } else if (strncmp(argv[i], "-xkbcompdir", 11)==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) {
+		    XkbBinDirectory = argv[i];
+		    return 2;
+		} else {
+		    LogMessage(X_ERROR, "-xkbcompdir pathname too long\n");
+		    return -1;
+		}
+	    }
+	} else {
+	    return -1;
+	}
     }
+
     if ((strcmp(argv[i], "-ardelay") == 0) || (strcmp(argv[i], "-ar1") == 0)) { /* -ardelay int */
         if (++i >= argc)
             UseMsg();
-- 
1.7.2.3

