This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Generate output with Unix line endings even from Mingw64 utils


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f5ecacfc6ccf4cd5c9fcd1601ad9919828b80a1d

commit f5ecacfc6ccf4cd5c9fcd1601ad9919828b80a1d
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Feb 24 20:55:14 2017 +0100

    Generate output with Unix line endings even from Mingw64 utils
    
    This affects cygcheck and strace.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/utils/cygcheck.cc | 4 ++++
 winsup/utils/strace.cc   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
index e745b20..2d5cda3 100644
--- a/winsup/utils/cygcheck.cc
+++ b/winsup/utils/cygcheck.cc
@@ -14,6 +14,7 @@
 #include <string.h>
 #include <sys/time.h>
 #include <ctype.h>
+#include <fcntl.h>
 #include <io.h>
 #include <windows.h>
 #include <wininet.h>
@@ -2251,6 +2252,9 @@ main (int argc, char **argv)
   bool ok = true;
   load_cygwin (argc, argv);
 
+  _setmode (1, _O_BINARY);
+  _setmode (2, _O_BINARY);
+
   /* Need POSIX sorting while parsing args, but don't forget the
      user's original environment.  */
   char *posixly = getenv ("POSIXLY_CORRECT");
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc
index 4046cce..beab67b 100644
--- a/winsup/utils/strace.cc
+++ b/winsup/utils/strace.cc
@@ -13,6 +13,7 @@ details. */
 #define cygwin_internal cygwin_internal_dontuse
 #include <stdio.h>
 #include <fcntl.h>
+#include <io.h>
 #include <getopt.h>
 #include <stdarg.h>
 #include <string.h>
@@ -1054,6 +1055,9 @@ main2 (int argc, char **argv)
 	  argc++;
     }
 
+  _setmode (1, _O_BINARY);
+  _setmode (2, _O_BINARY);
+
   if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/')))
     pgm = *argv;
   else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]