Damien Miller | bac2d8a | 2000-09-05 16:13:06 +1100 | [diff] [blame^] | 1 | /* |
| 2 | * |
| 3 | * cygwin_util.c |
| 4 | * |
| 5 | * Author: Corinna Vinschen <vinschen@cygnus.com> |
| 6 | * |
| 7 | * Copyright (c) 2000 Corinna Vinschen <vinschen@cygnus.com>, Duisburg, Germany |
| 8 | * All rights reserved |
| 9 | * |
| 10 | * Created: Sat Sep 02 12:17:00 2000 cv |
| 11 | * |
| 12 | * This file contains functions for forcing opened file descriptors to |
| 13 | * binary mode on Windows systems. |
| 14 | */ |
| 15 | |
| 16 | #include "config.h" |
| 17 | |
| 18 | #ifdef HAVE_CYGWIN |
| 19 | #include <fcntl.h> |
| 20 | #include <io.h> |
| 21 | |
| 22 | int binary_open(const char *filename, int flags, mode_t mode) |
| 23 | { |
| 24 | return open(filename, flags | O_BINARY, mode); |
| 25 | } |
| 26 | |
| 27 | int binary_pipe(int fd[2]) |
| 28 | { |
| 29 | int ret = pipe(fd); |
| 30 | if (!ret) { |
| 31 | setmode (fd[0], O_BINARY); |
| 32 | setmode (fd[1], O_BINARY); |
| 33 | } |
| 34 | } |
| 35 | #endif |