diff options
author | Egbert Eich <eich@freedesktop.org> | 2011-05-19 11:35:25 +0200 |
---|---|---|
committer | Egbert Eich <eich@freedesktop.org> | 2013-01-04 05:51:38 -0500 |
commit | 420347005ccf1886dfbb2eb2902beafdcf4e2477 (patch) | |
tree | e64ed5ee0261037eeb1992677b49d5a6b6dca525 | |
parent | 76f2c5b2a744587a9e97b622ab359d6fd7689604 (diff) |
Allow the CPP macro to contain preprocessors with command line options (v2)
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 <jcristau@debian.org>
to allocate memory for the dup string dynamically instead of
using a static buffer.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
-rw-r--r-- | xrdb.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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 */ |