Code

merged updated win32 port by Larry Adams and the cacti team
[rrdtool-all.git] / program / src / rrd_tool.c
index bb1bc3ed5304164e63d1778567ba2979d5e20864..0772b889d2439759db1c247c97e3911c048bf7f3 100644 (file)
@@ -4,10 +4,12 @@
  * rrd_tool.c  Startup wrapper
  *****************************************************************************/
 
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H)
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H)
 #include "../win32/config.h"
 #include <stdlib.h>
 #include <sys/stat.h>
+#include <io.h>
+#include <fcntl.h>
 #else
 #ifdef HAVE_CONFIG_H
 #include "../rrd_config.h"
@@ -414,6 +416,12 @@ int main(
        according to localeconv(3) */       
     setlocale(LC_ALL, "");
 
+#if defined(WIN32) && !defined(__CYGWIN__)
+    setmode(fileno(stdout), O_BINARY);
+    setmode(fileno(stdin), O_BINARY);
+#endif
+
+
 #if defined(HAVE_LIBINTL_H) && defined(BUILD_LIBINTL)
     bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
     textdomain(GETTEXT_PACKAGE);