]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Some more changes: added redirout/redirerr command line options
authorDale Weiler <killfieldengine@gmail.com>
Thu, 15 Nov 2012 03:38:20 +0000 (03:38 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Thu, 15 Nov 2012 03:38:20 +0000 (03:38 +0000)
Makefile
con.c
main.c

index b2d65805d0a3ca7c0b67877b8fca386d90fc3f9d..2a9c17f588e2eb87a8a97b0b8c3b72fea6aee679 100644 (file)
--- 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 3a15cc6982cb406042361bb9464de6426d07c949..bfe3a23c72650a60b7285f3eaba6618e2a1ede4c 100644 (file)
--- 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 1d151c5782152049fc2e1664977c4334bc64e93c..8e94800ec44bbd6460571481ee9243df0ff5f04c 100644 (file)
--- 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();