3 #include "imemstream.hpp"
8 #include <glog/logging.h>
10 #include <boost/iostreams/device/mapped_file.hpp>
12 int main(int argc
, char* argv
[])
14 auto const s0
= "\a\xa0\b\t\n\v\f\r\\";
15 CHECK_EQ(esc(s0
), "\\a\\xa0\\b\\t\\n\\v\\f\\r\\\\");
17 auto const s1
= "no characters to escape";
18 CHECK_EQ(esc(s1
), s1
);
20 for (auto arg
{1}; arg
< argc
; ++arg
) {
21 fs::path
const path
{argv
[arg
]};
23 auto const body_sz
{fs::file_size(path
)};
27 boost::iostreams::mapped_file_source file_source
{};
28 file_source
.open(path
);
30 imemstream isfile
{file_source
.data(), file_source
.size()};
32 while (std::getline(isfile
, line
)) {
34 line
+= '\n'; // since getline strips the newline
35 std::cout
<< esc(line
, esc_line_option::multi
) << '\n';