]> git.gag.com Git - fw/sdcc/commitdiff
Better implementation for --use-stdout
authorjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 20 Jun 2003 02:43:06 +0000 (02:43 +0000)
committerjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 20 Jun 2003 02:43:06 +0000 (02:43 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2711 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCC.lex
src/SDCCglobl.h
src/SDCCmain.c

index 9359359179ac991aabd4c1a0ffa8232bb575646a..cc78678f5ff61cd612094c0dddbcc67148ab680e 100644 (file)
@@ -671,11 +671,11 @@ int yyerror(char *s)
 
    if (mylineno && filename) {
         if(options.vc_err_style)
-               fprintf(stdout,"\n%s(%d) : %s: token -> '%s' ; column %d\n",
+               fprintf(stderr,"\n%s(%d) : %s: token -> '%s' ; column %d\n",
                        filename,mylineno,
                        s,yytext,column);
          else
-               fprintf(stdout,"\n%s:%d: %s: token -> '%s' ; column %d\n",
+               fprintf(stderr,"\n%s:%d: %s: token -> '%s' ; column %d\n",
                        filename,mylineno,
                        s,yytext,column);
      fatalError++;
index 0b6d6f8eb80668a62d6210f9d53034080717f5b1..711aa74d8dbe7f5313fc7d9851fc516d9904269f 100644 (file)
@@ -338,4 +338,15 @@ extern struct _dumpFiles dumpFiles[];
  */
 extern char scratchFileName[PATH_MAX];
 
+/* Define well known filenos if the system does not define them.  */
+#ifndef STDIN_FILENO
+# define STDIN_FILENO   0
+#endif
+#ifndef STDOUT_FILENO
+# define STDOUT_FILENO  1
+#endif
+#ifndef STDERR_FILENO
+# define STDERR_FILENO  2
+#endif
+
 #endif
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;
 }