libowfat/io/io_pipe.c

23 lines
364 B
C
Raw Normal View History

2003-09-02 00:14:04 +00:00
#include <unistd.h>
#include "io_internal.h"
int io_pipe(int64* d) {
#ifdef __MINGW32__
HANDLE fds[2];
if (CreatePipe(fds,fds+1,0,0)==0)
return 0;
#else
2003-09-02 00:14:04 +00:00
int fds[2];
if (pipe(fds)==-1)
return 0;
#endif
2004-02-27 14:50:28 +00:00
if (io_fd(fds[1]) && io_fd(fds[0])) {
d[0]=fds[0];
d[1]=fds[1];
return 1;
2003-09-02 00:14:04 +00:00
}
2004-02-27 14:50:28 +00:00
io_close(fds[1]);
io_close(fds[0]);
2003-09-02 00:14:04 +00:00
return 0;
}