[PATCH xrdb] Allow the CPP macro to contain preprocessors with command line options.

Egbert Eich eich at freedesktop.org
Thu Jan 3 10:56:46 PST 2013


The preprocessor used for xrdb may require a command line option to
produce the desired output. For the GNU cpp this could be
'traditional-cpp' which may not be valid for other preprocessors.
Therefore support the specification of preprocessors along with
required command line arguments when using the '--with-cpp' configure
option.
Example:
   ./configure --with-cpp="/usr/bin/cpp --traditional-cpp, /usr/lib/cpp".

Signed-off-by: Egbert Eich <eich at freedesktop.org>
---
 xrdb.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/xrdb.c b/xrdb.c
index 74ac03b..294bcc2 100644
--- a/xrdb.c
+++ b/xrdb.c
@@ -855,7 +855,13 @@ main(int argc, char *argv[])
 	int j;
 
 	for (j = 0; j < number_of_elements; j++) {
-	    if (access(cpp_locations[j], X_OK) == 0) {
+	    char *end, dup[PATH_MAX + 1] = { 0 };
+	    /* cut off arguments */
+	    strncpy(dup, cpp_locations[j], PATH_MAX);
+	    end = strchr(dup,' ');
+	    if (end)
+		*end = '\0';
+	    if (access(dup, X_OK) == 0) {
 		cpp_program = cpp_locations[j];
 		break;
 	    }
-- 
1.7.7



More information about the xorg-devel mailing list