Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-03-28 07:42:58 +0400
committerChristopher Faylor <me@cgf.cx>2001-03-28 07:42:58 +0400
commit1ac6d1a1443d8347f3fcbdab7792619dd9ad33ef (patch)
tree588d30857bcae78b7b7cbca426fdde61c40713a7 /winsup/cygwin/dtable.cc
parent6222b61feede1fd534c7ec1292f7cb51237bd201 (diff)
* lib/_cygwin_S_IEXEC.c: Remove "const" from globals or they never seem to be
defined. Wrap definitions in extern "C". Include winsup.h to assure proper definitions. * dcrt0.cc (dll_crt0_1): Call stdio_init after premain run so that binmode.o, etc., will control default stdio settings. * dtable.cc (dtable::init_std_file_from_handle): Allow __fmode to force binmode/textmode settings. Default pipes to binmode.
Diffstat (limited to 'winsup/cygwin/dtable.cc')
-rw-r--r--winsup/cygwin/dtable.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 31cdf4ab7..4c39035f9 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -165,7 +165,13 @@ void
dtable::init_std_file_from_handle (int fd, HANDLE handle,
DWORD myaccess, const char *name)
{
- int bin = binmode ? O_BINARY : 0;
+ int bin;
+
+ if (__fmode)
+ bin = __fmode;
+ else
+ bin = binmode ?: 0;
+
/* Check to see if we're being redirected - if not then
we open then as consoles */
if (fd == 0 || fd == 1 || fd == 2)
@@ -190,6 +196,11 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle,
else
name = "/dev/conin";
}
+ else if (GetFileType (handle) == FILE_TYPE_PIPE)
+ {
+ if (bin == 0)
+ bin = O_BINARY;
+ }
}
build_fhandler (fd, name, handle)->init (handle, myaccess, bin);