summaryrefslogtreecommitdiffstats
path: root/cygwin_util.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-09-05 16:13:06 +1100
committerDamien Miller <djm@mindrot.org>2000-09-05 16:13:06 +1100
commitbac2d8aa5e642a70045e713853b13d020b9c5d57 (patch)
tree98ddc81efce2273b3dfaff03b51242c988d30abf /cygwin_util.c
parent676092fad0b6edca8f1fe731d7c3a000465a9bef (diff)
- (djm) Merge cygwin support from Corinna Vinschen <vinschen@cygnus.com>
Diffstat (limited to 'cygwin_util.c')
-rw-r--r--cygwin_util.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/cygwin_util.c b/cygwin_util.c
new file mode 100644
index 00000000..13bd6634
--- /dev/null
+++ b/cygwin_util.c
@@ -0,0 +1,35 @@
+/*
+ *
+ * cygwin_util.c
+ *
+ * Author: Corinna Vinschen <vinschen@cygnus.com>
+ *
+ * Copyright (c) 2000 Corinna Vinschen <vinschen@cygnus.com>, Duisburg, Germany
+ * All rights reserved
+ *
+ * Created: Sat Sep 02 12:17:00 2000 cv
+ *
+ * This file contains functions for forcing opened file descriptors to
+ * binary mode on Windows systems.
+ */
+
+#include "config.h"
+
+#ifdef HAVE_CYGWIN
+#include <fcntl.h>
+#include <io.h>
+
+int binary_open(const char *filename, int flags, mode_t mode)
+{
+ return open(filename, flags | O_BINARY, mode);
+}
+
+int binary_pipe(int fd[2])
+{
+ int ret = pipe(fd);
+ if (!ret) {
+ setmode (fd[0], O_BINARY);
+ setmode (fd[1], O_BINARY);
+ }
+}
+#endif