From cb0db8b8d131ffd90991c46682023193790dcbec Mon Sep 17 00:00:00 2001
From: Bill Currie <bill@taniwha.org>
Date: Tue, 5 Feb 2002 19:35:45 +0000
Subject: [PATCH] disable debug putout and allow the cpp command line to be
 specified.

---
 tools/qfcc/include/qfcc.h |  1 -
 tools/qfcc/source/qfcc.c  | 19 ++++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/qfcc/include/qfcc.h b/tools/qfcc/include/qfcc.h
index 3cbfc4e68..14817aaf1 100644
--- a/tools/qfcc/include/qfcc.h
+++ b/tools/qfcc/include/qfcc.h
@@ -573,7 +573,6 @@ int	CopyString (const char *str);
 int	ReuseString (const char *str);
 
 typedef struct {
-	qboolean	cpp;				// use the C pre-processor
 	qboolean	cow;				// Turn constants into variables if written to
 	qboolean	debug;				// Generate debug info for the engine
 	int			progsversion;		// Progs version to generate code for
diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c
index 03d125c41..2a48ed626 100644
--- a/tools/qfcc/source/qfcc.c
+++ b/tools/qfcc/source/qfcc.c
@@ -84,6 +84,7 @@ static struct option const long_options[] = {
 	{"define", required_argument, 0, 'D'},
 	{"include", required_argument, 0, 'I'},
 	{"undefine", required_argument, 0, 'U'},
+	{"cpp", required_argument, 0, 256},
 #endif
 	{NULL, 0, NULL, 0}
 };
@@ -786,9 +787,9 @@ build_cpp_args (const char *in_name, const char *out_name)
 		}
 	}
 	*arg = 0;
-	for (arg = cpp_argv; *arg; arg++)
-		printf ("%s ", *arg);
-	puts ("");
+	//for (arg = cpp_argv; *arg; arg++)
+	//	printf ("%s ", *arg);
+	//puts ("");
 }
 #endif
 
@@ -804,7 +805,6 @@ DecodeArgs (int argc, char **argv)
 	add_cpp_def ("-D__RAUMOKO__=1");
 #endif
 
-	options.code.cpp = true;
 	options.code.progsversion = PROG_VERSION;
 	options.warnings.uninited_variable = true;
 
@@ -866,10 +866,8 @@ DecodeArgs (int argc, char **argv)
 							options.code.cow = true;
 						} else if (!(strcasecmp (temp, "no-cow"))) {
 							options.code.cow = false;
-						} else if (!(strcasecmp (temp, "cpp"))) {
-							options.code.cpp = true;
 						} else if (!(strcasecmp (temp, "no-cpp"))) {
-							options.code.cpp = false;
+							cpp_name = 0;
 						} else if (!(strcasecmp (temp, "debug"))) {
 							options.code.debug = true;
 						} else if (!(strcasecmp (temp, "no-debug"))) {
@@ -935,6 +933,9 @@ DecodeArgs (int argc, char **argv)
 				}
 				break;
 #ifdef USE_CPP
+			case 256:					// --cpp=
+				cpp_name = strdup (optarg);
+				break;
 			case 'S':					// save temps
 				options.save_temps = true;
 				break;
@@ -1081,7 +1082,7 @@ main (int argc, char **argv)
 			printf ("compiling %s\n", filename);
 
 #ifdef USE_CPP
-		if (options.code.cpp) {
+		if (cpp_name) {
 			if (options.save_temps) {
 				char	*basename = strdup (filename);
 				char	*temp;
@@ -1183,7 +1184,7 @@ main (int argc, char **argv)
 		error = yyparse () || pr_error_count;
 		fclose (yyin);
 #ifdef USE_CPP
-		if (options.code.cpp && (!options.save_temps)) {
+		if (cpp_name && (!options.save_temps)) {
 			if (unlink (tempname)) {
 				perror ("unlink");
 				exit (1);