From b0ba7a897f88f408a8f02abf40ee6e90cb743186 Mon Sep 17 00:00:00 2001 From: asynts Date: Mon, 7 Sep 2020 19:09:21 +0200 Subject: [PATCH] Userland: gunzip if filename doesn't end in .gz append it. This is the behaviour of gzip on my Linux system. --- Userland/gunzip.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/gunzip.cpp b/Userland/gunzip.cpp index 799ebc5709..5a344c8d41 100644 --- a/Userland/gunzip.cpp +++ b/Userland/gunzip.cpp @@ -55,8 +55,9 @@ int main(int argc, char** argv) if (write_to_stdout) keep_input_files = true; - for (StringView filename : filenames) { - ASSERT(filename.ends_with(".gz")); + for (String filename : filenames) { + if (!filename.ends_with(".gz")) + filename = String::format("%s.gz", filename); const auto input_filename = filename; const auto output_filename = filename.substring_view(0, filename.length() - 3);