From: Dale Weiler Date: Thu, 15 Nov 2012 03:38:20 +0000 (+0000) Subject: Some more changes: added redirout/redirerr command line options X-Git-Tag: 0.1~14 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0b8da9eeb4954dd334d5bac4526f42f837c60798;p=xonotic%2Fgmqcc.git Some more changes: added redirout/redirerr command line options --- diff --git a/Makefile b/Makefile index b2d6580..2a9c17f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC ?= clang -CFLAGS += -Wall -I. -fomit-frame-pointer -fno-stack-protector +CFLAGS += -Wall -I. -fomit-frame-pointer -fno-stack-protector -fno-common #turn on tons of warnings if clang is present ifeq ($(CC), clang) CFLAGS += \ diff --git a/con.c b/con.c index 3a15cc6..bfe3a23 100644 --- a/con.c +++ b/con.c @@ -118,7 +118,7 @@ static void win_fputs(char *str, FILE *f) { CONSOLE_SCREEN_BUFFER_INFO cinfo; GetConsoleScreenBufferInfo( - (h == stdout) ? + (GMQCC_IS_STDOUT(h)) ? GetStdHandle(STD_OUTPUT_HANDLE) : GetStdHandle(STD_ERROR_HANDLE), &cinfo ); @@ -172,7 +172,7 @@ static void win_fputs(char *str, FILE *f) { } /* restore */ SetConsoleTextAttribute( - (h == stdout) ? + (GMQCC_IS_STDOUT(h)) ? GetStdHandle(STD_OUTPUT_HANDLE) : GetStdHandle(STD_ERROR_HANDLE), icolor @@ -312,7 +312,6 @@ int con_out(const char *fmt, ...) { return ln; } - /* * Utility console message writes for lexer contexts. These will allow * for reporting of file:line based on lexer context, These are used diff --git a/main.c b/main.c index 1d151c5..8e94800 100644 --- a/main.c +++ b/main.c @@ -181,7 +181,10 @@ static void options_set(uint32_t *flags, size_t idx, bool on) static bool options_parse(int argc, char **argv) { bool argend = false; size_t itr; - char buffer[1024]; + char buffer[1024]; + char *redirout = (char*)stdout; + char *redirerr = (char*)stderr; + while (!argend && argc > 1) { char *argarg; argitem item; @@ -215,6 +218,13 @@ static bool options_parse(int argc, char **argv) { opts_forced_crc = strtol(argarg, NULL, 0); continue; } + if (options_long_gcc("redirout", &argc, &argv, &redirout)) { + continue; + } + if (options_long_gcc("redirerr", &argc, &argv, &redirerr)) { + continue; + } + if (!strcmp(argv[0]+1, "debug")) { opts_debug = true; continue; @@ -371,6 +381,7 @@ static bool options_parse(int argc, char **argv) { items_add(item); } } + con_change(redirout, redirerr); return true; } @@ -529,7 +540,7 @@ srcdone: cleanup: util_debug("COM", "cleaning ...\n"); - + con_close(); mem_d(items_data); parser_cleanup();