This commit is contained in:
Your Name 2023-11-26 13:13:38 +03:00
parent bbf0fd0aba
commit b88f882a17
3 changed files with 18 additions and 17 deletions

View File

@ -12,8 +12,9 @@
#define CLOCK CLOCK_MONOTONIC #define CLOCK CLOCK_MONOTONIC
#endif #endif
#define OS_SIZE 128
typedef struct { typedef struct {
char os_name[128]; char os_name[OS_SIZE + 1];
struct utsname uts; struct utsname uts;
char *pkg_cmd; char *pkg_cmd;

View File

@ -64,9 +64,11 @@ char *OpenBSD[] = {
}; };
char *PlainOs[] = { char *PlainOs[] = {
" /U /U ", " (\\(\\ ",
"( . .) ", " j . .) ",
"*(()()) ", " | ° ! ",
" ? ; ",
" c?\".UJ ",
" " " "
}; };

View File

@ -22,9 +22,6 @@ FETCH Init(void) {
if (GetOs(fetch.os_name, sizeof(fetch.os_name))) if (GetOs(fetch.os_name, sizeof(fetch.os_name)))
snprintf(fetch.os_name, sizeof(fetch.os_name), "%s", fetch.uts.sysname); 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; fetch.font_color = FONT_COLOR;
GetArt(&fetch); GetArt(&fetch);
return fetch; return fetch;
@ -36,10 +33,11 @@ int GetOs(char *os_name, size_t len) {
return 1; return 1;
while (fgets(os_name, len, fp)) { 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'; os_name[strlen(os_name) - 2] = '\0';
fclose(fp); snprintf(os_name, len, os_name + strlen("PRETTY_NAME=\""));
fclose(fp);
return 0; return 0;
} }
} }