mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 08:51:14 -03:00
Put io_data_t detail printing in virtual io_data_t::print
This commit is contained in:
41
io.cpp
41
io.cpp
@@ -51,6 +51,28 @@ Utilities for io redirection.
|
||||
#include "io.h"
|
||||
|
||||
|
||||
void io_data_t::print() const
|
||||
{
|
||||
switch (io_mode)
|
||||
{
|
||||
case IO_FILE:
|
||||
fprintf(stderr, "file (%s)\n", filename_cstr);
|
||||
break;
|
||||
case IO_PIPE:
|
||||
fprintf(stderr, "pipe {%d, %d}\n", param1.pipe_fd[0], param1.pipe_fd[1]);
|
||||
break;
|
||||
case IO_FD:
|
||||
fprintf(stderr, "FD map %d -> %d\n", param1.old_fd, fd);
|
||||
break;
|
||||
case IO_BUFFER:
|
||||
fprintf(stderr, "buffer %p (size %lu)\n", out_buffer_ptr(), out_buffer_size());
|
||||
break;
|
||||
case IO_CLOSE:
|
||||
fprintf(stderr, "close %d\n", fd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void io_buffer_read(io_data_t *d)
|
||||
{
|
||||
exec_close(d->param1.pipe_fd[1]);
|
||||
@@ -195,24 +217,7 @@ void io_print(const io_chain_t &chain)
|
||||
{
|
||||
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");
|
||||
switch (io->io_mode)
|
||||
{
|
||||
case IO_FILE:
|
||||
fprintf(stderr, "file (%s)\n", io->filename_cstr);
|
||||
break;
|
||||
case IO_PIPE:
|
||||
fprintf(stderr, "pipe {%d, %d}\n", io->param1.pipe_fd[0], io->param1.pipe_fd[1]);
|
||||
break;
|
||||
case IO_FD:
|
||||
fprintf(stderr, "FD map %d -> %d\n", io->param1.old_fd, io->fd);
|
||||
break;
|
||||
case IO_BUFFER:
|
||||
fprintf(stderr, "buffer %p (size %lu)\n", io->out_buffer_ptr(), io->out_buffer_size());
|
||||
break;
|
||||
case IO_CLOSE:
|
||||
fprintf(stderr, "close %d\n", io->fd);
|
||||
break;
|
||||
}
|
||||
io->print();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user