Signed-off-by: Sage Weil <sage@redhat.com>
}
-void buffer::list::hexdump(std::ostream &out) const
+void buffer::list::hexdump(std::ostream &out, bool trailing_newline) const
{
if (!length())
return;
did_star = false;
}
}
-
+ if (o)
+ out << "\n";
out << std::hex << std::setw(8) << o << " ";
unsigned i;
else
out << '.';
}
- out << '|' << std::dec << std::endl;
+ out << '|' << std::dec;
+ }
+ if (trailing_newline) {
+ out << "\n" << std::hex << std::setw(8) << length();
+ out << "\n";
}
- out << std::hex << std::setw(8) << length() << "\n";
out.flags(original_flags);
}
void decode_base64(list& o);
void write_stream(std::ostream &out) const;
- void hexdump(std::ostream &out) const;
+ void hexdump(std::ostream &out, bool trailing_newline = true) const;
int read_file(const char *fn, std::string *error);
ssize_t read_fd(int fd, size_t len);
int read_fd_zero_copy(int fd, size_t len);