summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhaturatu <taro@eyes4you.org>2024-06-27 22:11:27 +0900
committerhaturatu <taro@eyes4you.org>2024-06-27 22:11:27 +0900
commit7bfe462e5412a7157a570cefabfd303a7664a7b9 (patch)
tree28cd9a31a1c35c8f46a9b7109dc7a5cf947ba8f8 /src
parentb4307fffd9ef76efc612699a783e76368291f882 (diff)
Diffstat (limited to 'src')
-rw-r--r--src/logo/linux.c2
-rw-r--r--src/storage.c33
2 files changed, 13 insertions, 22 deletions
diff --git a/src/logo/linux.c b/src/logo/linux.c
index 0e2545f..e3a39c9 100644
--- a/src/logo/linux.c
+++ b/src/logo/linux.c
@@ -397,7 +397,7 @@ void getDistro(const char *distroname) {
for (int i = 9; i < minsize; i++) {
LOGO_SMALL[i] = GREEN " " RESET;
}
- } else if (strncmp((char *)distroname, "opensuse", strlen("opensuse")) == 0) {
+ } else if (strncmp((char *)distroname, "ubuntu", strlen("ubuntu")) == 0) {
color = RED;
titlecolor = RED;
logosize = 20;
diff --git a/src/storage.c b/src/storage.c
index 5500e93..909f477 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -2,28 +2,19 @@
#include "common.h"
#include <string.h>
+#include <stdlib.h>
const char *display_storage() {
- const char *excode = run_command_s("LC_ALL=C zpool list 2>/dev/null || echo $?");
+ const char *excode = run_command_s("zpool list 2>/dev/null || echo $?");
+ if ( excode != NULL && (strncmp(excode, "127", strlen("127")) == 0)) {
+ free((void *)excode);
+ return run_command_s("df -h | "
+ "awk '/^\\/dev\\// {printf \"%s: %s / %s, \", $1, $3, $2}' | "
+ "awk '{sub(/, $/, \"\"); print}'");
+ }
- if (excode != NULL && strcmp(excode, "127") == 0) {
- return run_command_s("df -h | "
- "awk '/^\\/dev\\// {printf \"%s: %s / %s, \", $1, $3, $2}' | "
- "awk '{sub(/, $/, \"\"); print}'");
- } else {
- const char *iszfs = run_command_s("LC_ALL=C zpool list 2>&1");
- if (
- strncmp(iszfs, "sh: zpool: not found", strlen("sh: zpool: not found")) == 0 ||
- strncmp(iszfs, "sh: 1: zpool: not found", strlen("sh: 1: zpool: not found")) == 0
- ) {
- return run_command_s("df -h | "
- "awk '/^\\/dev\\// {printf \"%s: %s / %s, \", $1, $3, $2}' | "
- "awk '{sub(/, $/, \"\"); print}'");
- } else {
- return run_command_s("zpool list | "
- "awk 'NR>1 {printf \"%s: %s / %s, \", $1, $3, $2}' | "
- "awk '{sub(/, $/, \"\"); print}'");
- }
- }
+ free((void *)excode);
+ return run_command_s("zpool list | "
+ "awk 'NR>1 {printf \"%s: %s / %s, \", $1, $3, $2}' | "
+ "awk '{sub(/, $/, \"\"); print}'");
}
-