From b88f882a175f79a0973b4a64a8e7eadf2f5fb473 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 26 Nov 2023 13:13:38 +0300 Subject: [PATCH] fix --- include/fetch.h | 3 ++- include/logo.h | 24 +++++++++++++----------- src/fetch.c | 8 +++----- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/fetch.h b/include/fetch.h index 1a5eea6..ae3844c 100644 --- a/include/fetch.h +++ b/include/fetch.h @@ -12,8 +12,9 @@ #define CLOCK CLOCK_MONOTONIC #endif +#define OS_SIZE 128 typedef struct { - char os_name[128]; + char os_name[OS_SIZE + 1]; struct utsname uts; char *pkg_cmd; diff --git a/include/logo.h b/include/logo.h index acdeb04..93965d5 100644 --- a/include/logo.h +++ b/include/logo.h @@ -32,13 +32,13 @@ char *Alpine[] = { }; char *Arch[] = { - "\033[1;34m /\\ ", - "\033[1;34m / \\ ", - "\033[1;34m /\\ \\ ", - "\033[1;34m / \\ ", - "\033[1;34m / ,, \\ ", - "\033[1;34m / | | -\\ ", - "\033[1;34m/_-'' ''-_\\", + "\033[1;34m /\\ ", + "\033[1;34m / \\ ", + "\033[1;34m /\\ \\ ", + "\033[1;34m / \\ ", + "\033[1;34m / ,, \\ ", + "\033[1;34m / | | -\\ ", + "\033[1;34m/_-'' ''-_\\ ", " " }; @@ -64,10 +64,12 @@ char *OpenBSD[] = { }; char *PlainOs[] = { - " /U /U ", - "( . .) ", - "*(()()) ", - " " + " (\\(\\ ", + " j . .) ", + " | ° ! ", + " ? ; ", + " c?\".UJ ", + " " }; char *Unknow[] = { diff --git a/src/fetch.c b/src/fetch.c index b5cf437..7890d79 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -22,9 +22,6 @@ FETCH Init(void) { if (GetOs(fetch.os_name, sizeof(fetch.os_name))) snprintf(fetch.os_name, sizeof(fetch.os_name), "%s", fetch.uts.sysname); - else - snprintf(fetch.os_name, sizeof(fetch.os_name), "%s", fetch.os_name + strlen("NAME=\"")); - fetch.font_color = FONT_COLOR; GetArt(&fetch); return fetch; @@ -36,10 +33,11 @@ int GetOs(char *os_name, size_t len) { return 1; while (fgets(os_name, len, fp)) { - if (!strncmp(os_name, "NAME=", 5)) { + if (!strncmp(os_name, "PRETTY_NAME=\"", 5)) { os_name[strlen(os_name) - 2] = '\0'; - fclose(fp); + snprintf(os_name, len, os_name + strlen("PRETTY_NAME=\"")); + fclose(fp); return 0; } }