From dea68d7b33b04ddb047a360542a1c7397bd31ca5 Mon Sep 17 00:00:00 2001 From: chatlanin Date: Wed, 19 Apr 2023 21:08:44 +0300 Subject: [PATCH] fix some error --- bin/main.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/bin/main.cpp b/bin/main.cpp index 3f20491..374900f 100644 --- a/bin/main.cpp +++ b/bin/main.cpp @@ -11,19 +11,26 @@ void print_in_color(const T& text, const std::string& color) } template -std::string get_size_string(const T& size) { - if (size < 1024) { +std::string get_size_string(const T& size) +{ + if (size < 1024) + { return std::to_string(size) + " B"; - } else if (size < 1024 * 1024) { + } + else if (size < 1024 * 1024) + { return std::to_string(size / 1024) + " KB"; - } else if (size < 1024 * 1024 * 1024) { + } + else if (size < 1024 * 1024 * 1024) + { return std::to_string(size / 1024 / 1024) + " MB"; - } else { + } + else + { return std::to_string(size / 1024 / 1024 / 1024) + " GB"; } } - auto main() -> int { std::ifstream fs("/etc/mtab"); @@ -39,8 +46,8 @@ auto main() -> int continue; } - unsigned long long total_size = (unsigned long long) stat.f_frsize * stat.f_blocks; - unsigned long long free_size = (unsigned long long) stat.f_frsize * stat.f_bfree; + unsigned long long total_size = (unsigned long long)stat.f_frsize * stat.f_blocks; + unsigned long long free_size = (unsigned long long)stat.f_frsize * stat.f_bfree; unsigned long long used_size = total_size - free_size; std::cout << "Точка монтирования: " << mount_entry->mnt_dir << "\n";