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):
30 getopt.add_option('d', "decompress", decompress, GetOpt::NO_ARG);
33 const vector<string> &args = getopt.get_args();
35 input_file = new IO::File(args[0]);
37 input = (input_file ? static_cast<IO::Base *>(input_file) : static_cast<IO::Base *>(&IO::cin));
41 zlib = new IO::ZlibCompressed(*input);
46 zlib = new IO::ZlibCompressed(*output);
62 unsigned len = input->read(buffer, sizeof(buffer));
65 output->write(buffer, len);