Better implementation for --use-stdout
[fw/sdcc] / src / SDCCmain.c
index 9f86359a3dd89a8420a35758c1e0150d21aa9bb0..6ca55ee3b0d7155c5e962cee0bb4ec8ba6838179 100644 (file)
@@ -22,6 +22,7 @@
    what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 
+#include <io.h>
 #include <signal.h>
 #include "common.h"
 #include <ctype.h>
@@ -1271,7 +1272,8 @@ parseCmdLine (int argc, char **argv)
        werror (E_FILE_OPEN_ERR, scratchFileName);
     }
   MSVC_style(options.vc_err_style);
-  if(options.use_stdout) SetErrorOut(stdout);
+  if(options.use_stdout) dup2(STDOUT_FILENO, STDERR_FILENO);
+
   return 0;
 }