[PATCH xrdb] Allow the CPP macro to contain preprocessors with command line options.
Julien Cristau
jcristau at debian.org
Thu Jan 3 11:56:12 PST 2013
On Thu, Jan 3, 2013 at 13:56:46 -0500, Egbert Eich wrote:
> 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);
can I suggest to replace the above with
char *end, *dup;
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);
to avoid the static PATH_MAX-sized buffer?
Cheers,
Julien
More information about the xorg-devel
mailing list