From 56870db1adfb83c415787bdcb9471ba04d3eb86f 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:14:36 +0900 Subject: =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=AC=E3=83=BC=E3=82=B8=E3=81=AE?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/storage.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/storage.c (limited to 'src/storage.c') diff --git a/src/storage.c b/src/storage.c new file mode 100644 index 0000000..a6e21fa --- /dev/null +++ b/src/storage.c @@ -0,0 +1,15 @@ +#include "storage.h" +#include "common.h" + +#include + +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'"); + } + + return run_command_s("df -h | awk 'NR>1 {print $1 \": \" $3 \" / \" $2}' | " + "sed ':a;N;$!ba;s/\\n/, /g'"); +} -- cgit v1.2.3