MINGW-packages/mingw-w64-bc/0003-use-binary-io.patch
Christopher Degawa d0ab5b6115
bc: update to 1.07.1
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
2022-01-10 22:02:17 -06:00

27 lines
732 B
Diff

diff -Naur bc-1.07.1-orig/bc/main.c bc-1.07.1/bc/main.c
--- bc-1.07.1-orig/bc/main.c 2017-04-07 17:20:02.000000000 -0500
+++ bc-1.07.1/bc/main.c 2022-01-10 22:00:50.009302332 -0600
@@ -33,6 +33,10 @@
#include "proto.h"
#include "getopt.h"
+#ifdef _WIN32
+#include <io.h>
+#include <fcntl.h>
+#endif
/* Variables for processing multiple files. */
static char first_file;
@@ -171,7 +175,10 @@
if (isatty(0) && isatty(1))
interactive = TRUE;
-#ifdef HAVE_SETVBUF
+#ifdef _WIN32
+ _setmode(_fileno(stdout), _O_BINARY);
+ (void)setvbuf(stdout, NULL, _IONBF, 0);
+#elif defined(HAVE_SETVBUF)
/* attempt to simplify interaction with applications such as emacs */
(void) setvbuf(stdout, NULL, _IOLBF, 0);
#endif