1 #include <msp/core/application.h>
2 #include <msp/core/getopt.h>
3 #include <msp/io/console.h>
4 #include <msp/io/file.h>
5 #include <msp/io/zlibcompressed.h>
10 class Z: public RegisteredApplication<Z>
13 IO::ZlibCompressed *zlib;
26 Z::Z(int argc, char **argv):
31 getopt.add_option('d', "decompress", decompress, GetOpt::NO_ARG);
32 getopt.add_argument("filename", input_fn, GetOpt::OPTIONAL_ARG);
36 input_file = new IO::File(input_fn);
38 input = (input_file ? static_cast<IO::Base *>(input_file) : static_cast<IO::Base *>(&IO::cin));
42 zlib = new IO::ZlibCompressed(*input);
47 zlib = new IO::ZlibCompressed(*output);
63 unsigned len = input->read(buffer, sizeof(buffer));
66 output->write(buffer, len);