~oriansj/M2-Mesoplanet

4bf3e2eded821cf9b69fd63a033272197a8703f7 — Jeremiah Orians 1 year, 1 month ago 3476160
Make --no-includes function how most people would expect it
2 files changed, 17 insertions(+), 6 deletions(-)

M cc.c
M cc_reader.c
M cc.c => cc.c +11 -3
@@ 34,6 34,8 @@ void output_tokens(struct token_list *i, FILE* out);
int strtoint(char *a);
void spawn_processes(int debug_flag, char* prefix, char* preprocessed_file, char* destination, char** envp);

int follow_includes;

void prechecks(int argc, char** argv)
{
	int env = 0;


@@ 82,6 84,11 @@ void prechecks(int argc, char** argv)
			require(0 < MAX_STRING, "Not a valid string size\nAbort and fix your --max-string\n");
			i += 2;
		}
		else if(match(argv[i], "--no-includes"))
		{
			follow_includes = FALSE;
			i+= 1;
		}
		else if(match(argv[i], "-I"))
		{
			hold = argv[i+1];


@@ 155,7 162,7 @@ int main(int argc, char** argv, char** envp)
	FILE* destination_file = stdout;
	char* name;
	int DUMP_MODE = FALSE;
	int follow_includes = TRUE;
	follow_includes = TRUE;

	/* Try to get our needed updates */
	prechecks(argc, argv);


@@ 208,9 215,10 @@ int main(int argc, char** argv, char** envp)
		}
		else if(match(argv[i], "--no-includes"))
		{
			follow_includes = FALSE;
			/* Handled by precheck*/
			i+= 1;
		}else if(match(argv[i], "--debug-mode"))
		}
		else if(match(argv[i], "--debug-mode"))
		{
			/* Handled by precheck */
			i+= 2;

M cc_reader.c => cc_reader.c +6 -3
@@ 385,9 385,12 @@ int include_file(int ch, int include_file)
	/* special case this compatibility crap */
	if(match("\"../gcc_req.h\"", new_filename) || match("\"gcc_req.h\"", new_filename)) return ch;

	fputs("reading file: ", stderr);
	fputs(new_filename, stderr);
	fputc('\n', stderr);
	if(include_file)
	{
		fputs("reading file: ", stderr);
		fputs(new_filename, stderr);
		fputc('\n', stderr);
	}

	/* catch garbage input */
	if(NULL == new_file)