From: Baptiste Daroussin Date: Fri, 9 Dec 2011 23:31:48 +0000 (+0100) Subject: FreeBSD: fix disk usage print X-Git-Tag: 2.4~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=be61907ad5faa0f0ee86555a30572debf59d3afc;p=i3%2Fi3status FreeBSD: fix disk usage print --- diff --git a/src/print_disk_info.c b/src/print_disk_info.c index b9ec84b..b2cbd9c 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -6,6 +6,11 @@ #include #include #include +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#include +#include +#endif + #include "i3status.h" @@ -39,10 +44,18 @@ static void print_bytes_human(uint64_t bytes) { */ void print_disk_info(const char *path, const char *format) { const char *walk; + +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + struct statfs buf; + + if (statfs(path, &buf) == -1) + return; +#else struct statvfs buf; if (statvfs(path, &buf) == -1) return; +#endif for (walk = format; *walk != '\0'; walk++) { if (*walk != '%') {