From 57ef5289feb4f8551031cc1077df7c33be2180bb Mon Sep 17 00:00:00 2001 From: Cheer Xiao Date: Wed, 16 Jan 2013 11:55:57 +0800 Subject: Make is_input a member of io_pipe_t --- io.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'io.cpp') 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 &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(); } } -- cgit v1.2.3