Blame SOURCES/0001-Default-to-nocpp.patch

dbc595
diff -up xrdb-1.0.9/xrdb.c.nocpp xrdb-1.0.9/xrdb.c
dbc595
--- xrdb-1.0.9/xrdb.c.nocpp	2011-04-05 12:01:15.000000000 -0400
dbc595
+++ xrdb-1.0.9/xrdb.c	2013-10-02 10:48:30.774355639 -0400
dbc595
@@ -845,23 +845,6 @@ main(int argc, char *argv[])
dbc595
     /* initialize the includes String struct */
dbc595
     addstring(&includes, "");
dbc595
 
dbc595
-    /* Pick the default cpp to use.  This needs to be done before
dbc595
-     * we parse the command line in order to honor -nocpp which sets
dbc595
-     * it back to NULL.
dbc595
-     */
dbc595
-    if (cpp_program == NULL) {
dbc595
-	int number_of_elements
dbc595
-	    = (sizeof cpp_locations) / (sizeof cpp_locations[0]);
dbc595
-	int j;
dbc595
-
dbc595
-	for (j = 0; j < number_of_elements; j++) {
dbc595
-	    if (access(cpp_locations[j], X_OK) == 0) {
dbc595
-		cpp_program = cpp_locations[j];
dbc595
-		break;
dbc595
-	    }
dbc595
-	} 
dbc595
-    }
dbc595
-
dbc595
     /* needs to be replaced with XrmParseCommand */
dbc595
 
dbc595
     for (i = 1; i < argc; i++) {
dbc595
@@ -956,6 +939,27 @@ main(int argc, char *argv[])
dbc595
 	    filename = arg;
dbc595
     }							/* end for */
dbc595
 
dbc595
+    if (cpp_program != NULL) {
dbc595
+	int number_of_elements
dbc595
+	    = (sizeof cpp_locations) / (sizeof cpp_locations[0]);
dbc595
+	int j;
dbc595
+
dbc595
+	for (j = 0; j < number_of_elements; j++) {
dbc595
+	    char *end, *dup;
dbc595
+	    /* cut off arguments */
dbc595
+	    dup = strdup(cpp_locations[j]);
dbc595
+	    end = strchr(dup,' ');
dbc595
+	    if (end)
dbc595
+		*end = '\0';
dbc595
+	    if (access(dup, X_OK) == 0) {
dbc595
+		cpp_program = cpp_locations[j];
dbc595
+		free(dup);
dbc595
+		break;
dbc595
+	    }
dbc595
+	    free(dup);
dbc595
+	}
dbc595
+    }
dbc595
+
dbc595
 #ifndef WIN32
dbc595
     while ((i = open("/dev/null", O_RDONLY)) < 3)
dbc595
 	; /* make sure later freopen won't clobber things */