From 2fe1aa6de98d0f0c6c9e4a8dcf9192c6b3392883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Fri, 21 Jun 2024 22:26:50 +0900 Subject: =?UTF-8?q?FreeBSD=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/storage.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/storage.c b/src/storage.c index a6e21fa..5471a62 100644 --- a/src/storage.c +++ b/src/storage.c @@ -5,11 +5,16 @@ const char *display_storage() { const char *iszfs = run_command_s("LC_ALL=C zpool list 2>&1"); - if (strstr(iszfs, "command not found: zpool")) { - return run_command_s("zpool list | awk 'NR>1 {print $1 \": \" $3 \" / \" $2}' | " - "sed ':a;N;$!ba;s//, /g'"); + if (!strstr(iszfs, "command not found: zpool")) { + return run_command_s("zpool list | " + "awk 'NR>1 {printf \"%s: %s / %s, \", $1, $3, $2}' | " + "awk '{sub(/, $/, \"\"); print}'"); } + return run_command_s("df -h | " + "awk '/^\\/dev\\// {printf \"%s: %s / %s, \", $1, $3, $2}' | " + "awk '{sub(/, $/, \"\"); print}'"); + return run_command_s("df -h | awk 'NR>1 {print $1 \": \" $3 \" / \" $2}' | " "sed ':a;N;$!ba;s/\\n/, /g'"); } -- cgit v1.2.3