]> sjero.net Git - wget/blobdiff - src/main.c
Set stdout mode to binary under Windows.
[wget] / src / main.c
index 3a0525034aa09937b6b4f585ab0a2ee1f7b61c30..8b3212a4ede980fdc5044f6272a55b84823eaa21 100644 (file)
@@ -60,8 +60,13 @@ as that of the covered work.  */
 #include <getpass.h>
 #include <quote.h>
 
+#ifdef WINDOWS
+# include <io.h>
+# include <fcntl.h>
+#endif
+
 #ifdef __VMS
-#include "vms.h"
+# include "vms.h"
 #endif /* __VMS */
 
 #ifndef PATH_SEPARATOR
@@ -1249,14 +1254,7 @@ for details.\n\n"));
       if (HYPHENP (opt.output_document))
         {
 #ifdef WINDOWS
-          FILE *result;
-          result = freopen ("CONOUT$", "wb", stdout);
-          if (result == NULL)
-            {
-              logputs (LOG_NOTQUIET, _("\
-WARNING: Can't reopen standard output in binary mode;\n\
-         downloaded file may contain inappropriate line endings.\n"));
-            }
+          _setmode (_fileno (stdout), _O_BINARY);
 #endif
           output_stream = stdout;
         }