+2009-08-23 Bruno Haible <bruno@clisp.org>
+
+ * lib/pipe2.c (pipe2): Move #ifs inside function.
+
2009-08-22 Joel E. Denny <jdenny@clemson.edu>
quotearg: document limitations of quote_these_too
# include <io.h>
+#else
+/* Unix API. */
+
+# ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+# endif
+
+#endif
+
int
pipe2 (int fd[2], int flags)
{
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Native Woe32 API. */
+
/* Check the supported flags. */
if ((flags & ~(O_CLOEXEC | O_BINARY | O_TEXT)) != 0)
{
}
return _pipe (fd, 4096, flags);
-}
#else
/* Unix API. */
-# ifndef O_CLOEXEC
-# define O_CLOEXEC 0
-# endif
-
-int
-pipe2 (int fd[2], int flags)
-{
/* Check the supported flags. */
if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_TEXT | O_BINARY)) != 0)
{
goto fail;
}
-#if O_BINARY
+# if O_BINARY
if (flags & O_BINARY)
{
setmode (fd[1], O_BINARY);
setmode (fd[1], O_TEXT);
setmode (fd[0], O_TEXT);
}
-#endif
+# endif
return 0;
errno = saved_errno;
return -1;
}
-}
#endif
+}