remove wrong compression mode
This commit is contained in:
@ -72,11 +72,11 @@
|
||||
struct compress_info {
|
||||
/// identifier for the different compression algorithms
|
||||
enum styles { NONE, GZIP, BZIP2, ZSTD, XZ, LZMA, LZ4 };
|
||||
const std::string extension; ///< filename extension for the current algorithm
|
||||
const std::string command; ///< command to perform compression or decompression
|
||||
const std::string extension; ///< filename extension for the current algorithm
|
||||
const std::string command; ///< command to perform compression or decompression
|
||||
const std::string compressflags; ///< flags to append to compress from stdin to stdout
|
||||
const std::string uncompressflags; ///< flags to decompress file to stdout
|
||||
const int style; ///< compression style flag
|
||||
const int style; ///< compression style flag
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
@ -88,7 +88,6 @@ static const std::vector<compress_info> compress_styles = {
|
||||
{"xz", "xz", " > ", " -cdf ", compress_info::XZ},
|
||||
{"lzma", "xz", " --format=lzma > ", " --format=lzma -cdf ", compress_info::LZMA},
|
||||
{"lz4", "lz4", " > ", " -cdf ", compress_info::LZ4},
|
||||
{"bin", "", "", "", compress_info::LZ4},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@ -231,16 +230,16 @@ std::string platform::os_info()
|
||||
|
||||
if (platform::file_is_readable("/etc/os-release")) {
|
||||
try {
|
||||
TextFileReader reader("/etc/os-release","");
|
||||
while (true) {
|
||||
auto words = reader.next_values(0,"=");
|
||||
if ((words.count() > 1) && (words.next_string() == "PRETTY_NAME")) {
|
||||
buf += " " + utils::trim(words.next_string());
|
||||
break;
|
||||
}
|
||||
TextFileReader reader("/etc/os-release", "");
|
||||
while (true) {
|
||||
auto words = reader.next_values(0, "=");
|
||||
if ((words.count() > 1) && (words.next_string() == "PRETTY_NAME")) {
|
||||
buf += " " + utils::trim(words.next_string());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
; // EOF but keyword not found
|
||||
; // EOF but keyword not found
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,11 +427,11 @@ std::string platform::compress_info()
|
||||
std::string buf = "Available compression formats:\n\n";
|
||||
bool none_found = true;
|
||||
for (const auto &cmpi : compress_styles) {
|
||||
if (cmpi.style == ::compress_info::NONE) continue;
|
||||
if (find_exe_path(cmpi.command).size()) {
|
||||
none_found = false;
|
||||
buf += fmt::format("Extension: .{:6} Command: {}\n", cmpi.extension, cmpi.command);
|
||||
}
|
||||
if (cmpi.style == ::compress_info::NONE) continue;
|
||||
if (find_exe_path(cmpi.command).size()) {
|
||||
none_found = false;
|
||||
buf += fmt::format("Extension: .{:6} Command: {}\n", cmpi.extension, cmpi.command);
|
||||
}
|
||||
}
|
||||
if (none_found) buf += "None\n";
|
||||
return buf;
|
||||
@ -451,7 +450,7 @@ int platform::putenv(const std::string &vardef)
|
||||
if (found == std::string::npos)
|
||||
return _putenv_s(vardef.c_str(), "1");
|
||||
else
|
||||
return _putenv_s(vardef.substr(0, found).c_str(), vardef.substr(found+1).c_str());
|
||||
return _putenv_s(vardef.substr(0, found).c_str(), vardef.substr(found + 1).c_str());
|
||||
#else
|
||||
if (found == std::string::npos)
|
||||
return setenv(vardef.c_str(), "", 1);
|
||||
@ -473,7 +472,7 @@ int platform::unsetenv(const std::string &variable)
|
||||
const char *ptr = getenv(variable.c_str());
|
||||
if (!ptr) return -1;
|
||||
// empty _putenv_s() definition deletes variable
|
||||
return _putenv_s(variable.c_str(),"");
|
||||
return _putenv_s(variable.c_str(), "");
|
||||
#else
|
||||
return ::unsetenv(variable.c_str());
|
||||
#endif
|
||||
@ -580,8 +579,10 @@ void *platform::dlopen(const std::string &fname)
|
||||
std::string platform::dlerror()
|
||||
{
|
||||
const char *errmesg = ::dlerror();
|
||||
if (errmesg) return {errmesg};
|
||||
else return {""};
|
||||
if (errmesg)
|
||||
return {errmesg};
|
||||
else
|
||||
return {""};
|
||||
}
|
||||
|
||||
// close a shared object
|
||||
@ -985,7 +986,7 @@ FILE *platform::compressed_read(const std::string &file)
|
||||
if (find_exe_path(compress.command).size())
|
||||
// put quotes around file name so that they may contain blanks
|
||||
fp = popen((compress.command + compress.uncompressflags + "\"" + file + "\""), "r");
|
||||
else
|
||||
else
|
||||
fp = popen("", "r");
|
||||
#endif
|
||||
return fp;
|
||||
|
||||
Reference in New Issue
Block a user