Don't dump binary data to stdout
This commit is contained in:
parent
295b323996
commit
7d4c9dcabb
6
cc.c
6
cc.c
|
@ -46,7 +46,7 @@ int main(int argc, char** argv, char** envp)
|
||||||
int debug_flag = TRUE;
|
int debug_flag = TRUE;
|
||||||
FILE* in = stdin;
|
FILE* in = stdin;
|
||||||
FILE* tempfile;
|
FILE* tempfile;
|
||||||
char* destination_name = "/dev/stdout";
|
char* destination_name = "a.out";
|
||||||
FILE* destination_file = stdout;
|
FILE* destination_file = stdout;
|
||||||
init_macro_env("__M2__", "42", "__INTERNAL_M2__", 0); /* Setup __M2__ */
|
init_macro_env("__M2__", "42", "__INTERNAL_M2__", 0); /* Setup __M2__ */
|
||||||
char* name;
|
char* name;
|
||||||
|
@ -174,12 +174,8 @@ int main(int argc, char** argv, char** envp)
|
||||||
{
|
{
|
||||||
fputs("\n/* Preprocessed source */\n", destination_file);
|
fputs("\n/* Preprocessed source */\n", destination_file);
|
||||||
output_tokens(global_token, destination_file);
|
output_tokens(global_token, destination_file);
|
||||||
|
|
||||||
if (destination_file != stdout)
|
|
||||||
{
|
|
||||||
fclose(destination_file);
|
fclose(destination_file);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = calloc(100, sizeof(char));
|
name = calloc(100, sizeof(char));
|
||||||
|
|
21
cc_macro.c
21
cc_macro.c
|
@ -653,9 +653,25 @@ void macro_directive()
|
||||||
{
|
{
|
||||||
handle_error();
|
handle_error();
|
||||||
}
|
}
|
||||||
else
|
else if(match("#include", macro_token->s))
|
||||||
{
|
{
|
||||||
if(!match("#include", macro_token->s))
|
eat_current_token();
|
||||||
|
if(match("<", macro_token->s))
|
||||||
|
{
|
||||||
|
eat_current_token();
|
||||||
|
if(match("stdio", macro_token->s))
|
||||||
|
{
|
||||||
|
eat_current_token();
|
||||||
|
STDIO_USED = TRUE;
|
||||||
|
}
|
||||||
|
eat_current_token();
|
||||||
|
eat_current_token();
|
||||||
|
eat_current_token();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
eat_current_token();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* Put a big fat warning but see if we can just ignore */
|
/* Put a big fat warning but see if we can just ignore */
|
||||||
fputs(">>WARNING<<\n>>WARNING<<\n", stderr);
|
fputs(">>WARNING<<\n>>WARNING<<\n", stderr);
|
||||||
|
@ -663,7 +679,6 @@ void macro_directive()
|
||||||
fputs("feature: ", stderr);
|
fputs("feature: ", stderr);
|
||||||
fputs(macro_token->s, stderr);
|
fputs(macro_token->s, stderr);
|
||||||
fputs(" unsupported in M2-Planet\nIgnoring line, may result in bugs\n>>WARNING<<\n>>WARNING<<\n\n", stderr);
|
fputs(" unsupported in M2-Planet\nIgnoring line, may result in bugs\n>>WARNING<<\n>>WARNING<<\n\n", stderr);
|
||||||
}
|
|
||||||
|
|
||||||
/* unhandled macro directive; let's eat until a newline; om nom nom */
|
/* unhandled macro directive; let's eat until a newline; om nom nom */
|
||||||
while(TRUE)
|
while(TRUE)
|
||||||
|
|
Loading…
Reference in New Issue