summaryrefslogtreecommitdiff
path: root/src/storage.c
diff options
context:
space:
mode:
author諏訪子 <suwako@076.moe>2024-06-21 22:26:50 +0900
committer諏訪子 <suwako@076.moe>2024-06-21 22:26:50 +0900
commit2fe1aa6de98d0f0c6c9e4a8dcf9192c6b3392883 (patch)
tree82412f46a630709d6cd927f420f5a79eb14d4d31 /src/storage.c
parent56870db1adfb83c415787bdcb9471ba04d3eb86f (diff)
FreeBSDの場合の修正
Diffstat (limited to 'src/storage.c')
-rw-r--r--src/storage.c11
1 files changed, 8 insertions, 3 deletions
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'");
}