summaryrefslogtreecommitdiff
path: root/src/storage.c
diff options
context:
space:
mode:
author諏訪子 <suwako@076.moe>2024-06-21 22:14:36 +0900
committer諏訪子 <suwako@076.moe>2024-06-21 22:14:36 +0900
commit56870db1adfb83c415787bdcb9471ba04d3eb86f (patch)
tree964bc3d59d3e88b214f8717075216bceda6f54c0 /src/storage.c
parent95eedef25d4fad567445dc4f74cd604a4ab3ab1d (diff)
ストレージの表示
Diffstat (limited to 'src/storage.c')
-rw-r--r--src/storage.c15
1 files changed, 15 insertions, 0 deletions
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 <string.h>
+
+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'");
+}