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".

v2: Followed a suggestion by Julien Cristau <jcris...@debian.org>
    to allocate memory for the dup string dynamically instead of
    using a static buffer.

Signed-off-by: Egbert Eich <e...@freedesktop.org>
---
 xrdb.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/xrdb.c b/xrdb.c
index 74ac03b..b7c9fa3 100644
--- a/xrdb.c
+++ b/xrdb.c
@@ -855,11 +855,19 @@ 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;
+           /* cut off arguments */
+           dup = strdup(cpp_locations[j]);
+           end = strchr(dup,' ');
+           if (end)
+               *end = '\0';
+           if (access(dup, X_OK) == 0) {
                cpp_program = cpp_locations[j];
+               free(dup);
                break;
            }
-       } 
+           free(dup);
+       }
     }
 
     /* needs to be replaced with XrmParseCommand */
-- 
1.7.7

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to