refactored project structure

This commit is contained in:
Linus Dierheimer
2021-02-27 16:40:05 +01:00
parent 558639086a
commit b44ab16dd1
26 changed files with 219 additions and 211 deletions
+25
View File
@@ -0,0 +1,25 @@
#include "fastfetch.h"
#include <sys/statvfs.h>
void ffPrintDisk(FFstate* state)
{
struct statvfs fs;
int ret = statvfs("/", &fs);
if(ret != 0)
{
ffPrintError(state, "Disk (/)", "statvfs(\"/\", &fs) != 0");
return;
}
const uint32_t GB = (1024 * 1024) * 1024;
const uint32_t total = (fs.f_blocks * fs.f_frsize) / GB;
const uint32_t available = (fs.f_bfree * fs.f_frsize) / GB;
const uint32_t used = total - available;
const uint32_t percentage = (used / (double) total) * 100.0;
ffPrintLogoAndKey(state, "Disk (/)");
printf("%uGB / %uGB (%u%%)\n", used, total, percentage);
}