aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.cpp
diff options
context:
space:
mode:
authorGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-16 11:55:57 +0800
committerGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-17 15:55:06 +0800
commit57ef5289feb4f8551031cc1077df7c33be2180bb (patch)
tree4c42b39e0599adfeda8d33a494ddf7e2b06a63b5 /io.cpp
parenta63c0311bbd7ce2831a7b130f07b3a703d51201b (diff)
Make is_input a member of io_pipe_t
Diffstat (limited to 'io.cpp')
-rw-r--r--io.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/io.cpp b/io.cpp
index 6c42b6a3..241f89d9 100644
--- a/io.cpp
+++ b/io.cpp
@@ -72,12 +72,14 @@ void io_file_t::print() const
void io_pipe_t::print() const
{
- fprintf(stderr, "pipe {%d, %d}\n", pipe_fd[0], pipe_fd[1]);
+ fprintf(stderr, "pipe {%d, %d} (input: %s)\n", pipe_fd[0], pipe_fd[1],
+ is_input ? "yes" : "no");
}
void io_buffer_t::print() const
{
- fprintf(stderr, "buffer %p (size %lu)\n", out_buffer_ptr(), out_buffer_size());
+ fprintf(stderr, "buffer %p (input: %s, size %lu)\n", out_buffer_ptr(),
+ is_input ? "yes" : "no", out_buffer_size());
}
void io_buffer_t::read()
@@ -132,8 +134,7 @@ void io_buffer_t::read()
io_buffer_t *io_buffer_t::create(bool is_input)
{
bool success = true;
- io_buffer_t *buffer_redirect = new io_buffer_t(is_input ? 0 : 1);
- buffer_redirect->is_input = is_input ? true : false;
+ io_buffer_t *buffer_redirect = new io_buffer_t(is_input ? 0 : 1, is_input);
if (exec_pipe(buffer_redirect->pipe_fd) == -1)
{
@@ -221,7 +222,7 @@ void io_print(const io_chain_t &chain)
for (size_t i=0; i < chain.size(); i++)
{
const shared_ptr<const io_data_t> &io = chain.at(i);
- fprintf(stderr, "\t%lu: fd:%d, input:%s, ", (unsigned long)i, io->fd, io->is_input ? "yes" : "no");
+ fprintf(stderr, "\t%lu: fd:%d, ", (unsigned long)i, io->fd);
io->print();
}
}