Module Name:    xsrc
Committed By:   mrg
Date:           Sat Dec  5 03:29:11 UTC 2009

Modified Files:
        xsrc/external/mit/xrdb/dist: xrdb.c

Log Message:
- add a new -cppargs option
- default -cppargs to the CPPARGS variable if defined.
- add cppargs to the cpp command if defined.

part2 of xrdb fixes.  thanks to Patrick Welche <pr...@cam.ac.uk> for
figuring out what was going wrong, and testing these changes.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 xsrc/external/mit/xrdb/dist/xrdb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xrdb/dist/xrdb.c
diff -u xsrc/external/mit/xrdb/dist/xrdb.c:1.1.1.2 xsrc/external/mit/xrdb/dist/xrdb.c:1.2
--- xsrc/external/mit/xrdb/dist/xrdb.c:1.1.1.2	Sun Nov  8 11:36:38 2009
+++ xsrc/external/mit/xrdb/dist/xrdb.c	Sat Dec  5 03:29:11 2009
@@ -130,6 +130,10 @@
 static int oper = OPLOAD;
 static char *editFile = NULL;
 static const char *cpp_program = NULL;
+#ifndef CPP_ARGS
+#define CPP_ARGS	NULL
+#endif
+static const char *cpp_args = CPP_ARGS;
 static const char* const cpp_locations[] = { CPP };
 static char *backup_suffix = BACKUP_SUFFIX;
 static Bool dont_execute = False;
@@ -808,6 +812,10 @@
 		if (++i >= argc) Syntax ();
 		cpp_program = argv[i];
 		continue;
+	    } else if (isabbreviation ("-cppargs", arg, 2)) {
+		if (++i >= argc) Syntax ();
+		cpp_args = argv[i];
+		continue;
 	    } else if (!strcmp ("-n", arg)) {
 		dont_execute = True;
 		continue;
@@ -1170,8 +1178,10 @@
 		       1 + strlen(tmpname2) + 3 + strlen(tmpname3) + 1)) ==
 	       NULL)
 		fatal("%s: Out of memory\n", ProgramName);
-	    sprintf(cmd, "%s%s %s > %s", cpp_program, includes.val,
-		    tmpname2, tmpname3);
+	    sprintf(cmd, "%s%s%s%s %s > %s", cpp_program,
+		    cpp_args ? " " : "",
+		    cpp_args ? cpp_args : "",
+		    includes.val, tmpname2, tmpname3);
 	    if (system(cmd) < 0)
 		fatal("%s: cannot run '%s'\n", ProgramName, cmd);
 	    free(cmd);
@@ -1188,7 +1198,10 @@
 		malloc(strlen(cpp_program) + strlen(includes.val) + 1)) ==
 	       NULL)
 		fatal("%s: Out of memory\n", ProgramName);
-	    sprintf(cmd, "%s%s", cpp_program, includes.val);
+	    sprintf(cmd, "%s%s%s%s", cpp_program,
+		    cpp_args ? " " : "",
+		    cpp_args ? cpp_args : "",
+		    includes.val);
 	    if (!(input = popen(cmd, "r")))
 		fatal("%s: cannot run '%s'\n", ProgramName, cmd);
 	    free(cmd);
@@ -1209,7 +1222,9 @@
 		       strlen(tmpname3) + 1)) ==
 	       NULL)
 		fatal("%s: Out of memory\n", ProgramName);
-	    sprintf(cmd, "%s%s %s %s > %s", cpp_program,
+	    sprintf(cmd, "%s%s%s%s %s %s > %s", cpp_program,
+		    cpp_args ? " " : "",
+		    cpp_args ? cpp_args : "",
 		    includes.val, defines.val,
 		    filename ? filename : "", tmpname3);
 	    if (system(cmd) < 0)
@@ -1224,7 +1239,9 @@
 		       strlen(filename ? filename : "") + 1)) ==
 	       NULL)
 		fatal("%s: Out of memory\n", ProgramName);
-	    sprintf(cmd, "%s%s %s %s", cpp_program,
+	    sprintf(cmd, "%s%s%s%s %s %s", cpp_program,
+		    cpp_args ? " " : "",
+		    cpp_args ? cpp_args : "",
 		    includes.val, defines.val,
 		    filename ? filename : "");
 	    if (!(input = popen(cmd, "r")))

Reply via email to