fix some error
This commit is contained in:
parent
cf2b28beca
commit
dea68d7b33
23
bin/main.cpp
23
bin/main.cpp
@ -11,19 +11,26 @@ void print_in_color(const T& text, const std::string& color)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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";
|
||||
|
Loading…
Reference in New Issue
Block a user