mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-12 14:10:36 -04:00
Add human mode
This commit is contained in:
parent
834942a92b
commit
06b700d0c5
@ -14,8 +14,16 @@
|
|||||||
|
|
||||||
static constexpr const size_t BUFFER_SIZE = 4096;
|
static constexpr const size_t BUFFER_SIZE = 4096;
|
||||||
|
|
||||||
int main(int, char*[]){
|
int main(int argc, char* argv[]){
|
||||||
//TODO Add support to mount new directories
|
bool human = false;
|
||||||
|
|
||||||
|
for(size_t i = 1; i < argc; ++i){
|
||||||
|
std::string param(argv[i]);
|
||||||
|
|
||||||
|
if(param == "-h"){
|
||||||
|
human = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto buffer = new char[BUFFER_SIZE];
|
auto buffer = new char[BUFFER_SIZE];
|
||||||
|
|
||||||
@ -35,7 +43,12 @@ int main(int, char*[]){
|
|||||||
|
|
||||||
if(statfs_result.valid()){
|
if(statfs_result.valid()){
|
||||||
auto& statfs = *statfs_result;
|
auto& statfs = *statfs_result;
|
||||||
|
|
||||||
|
if(human){
|
||||||
|
printf("%s %m %m %m\n", mount_point, statfs.total_size, statfs.total_size - statfs.free_size, statfs.free_size);
|
||||||
|
} else {
|
||||||
printf("%s %u %u %u\n", mount_point, statfs.total_size, statfs.total_size - statfs.free_size, statfs.free_size);
|
printf("%s %u %u %u\n", mount_point, statfs.total_size, statfs.total_size - statfs.free_size, statfs.free_size);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("df: error: %s\n", std::error_message(statfs_result.error()));
|
printf("df: error: %s\n", std::error_message(statfs_result.error()));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user