diff options
author | lloyd <[email protected]> | 2015-02-05 06:15:33 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-02-05 06:15:33 +0000 |
commit | 2c14faf0aa1cfe0f8d70af1938dcad5b4d6d3b59 (patch) | |
tree | a3c7fb8f328a20c5a13dc796d9397d6a295e2000 /src/cmd | |
parent | ba20c74752581c559332defe3e1b83d5b7901d43 (diff) |
Fix build problem with recent LZMA library.
Fix retreival of LZMA and bzip2 compressors from make_compressor.
Allow setting compression level from command line.
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/compress.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/compress.cpp b/src/cmd/compress.cpp index 646a4d587..d7456fc31 100644 --- a/src/cmd/compress.cpp +++ b/src/cmd/compress.cpp @@ -35,9 +35,9 @@ void do_compress(Transform& comp, std::ifstream& in, std::ostream& out) int compress(int argc, char* argv[]) { - if(argc != 2 && argc != 3) + if(argc != 2 && argc != 3 && argc != 4) { - std::cout << "Usage: " << argv[0] << " input [type]\n"; + std::cout << "Usage: " << argv[0] << " input [type] [level]\n"; return 1; } @@ -50,8 +50,8 @@ int compress(int argc, char* argv[]) return 1; } - const size_t level = 9; - const std::string suffix = argc == 3 ? argv[2] : "gz"; + const std::string suffix = argc >= 3 ? argv[2] : "gz"; + const size_t level = argc >= 4 ? to_u32bit(argv[3]) : 9; std::unique_ptr<Transform> compress(make_compressor(suffix, level)); |