main.c fix logo print

This commit is contained in:
Your Name 2023-12-15 18:45:57 +03:00
parent e59cd1d2a0
commit 2f88885982
3 changed files with 14 additions and 8 deletions

View File

@ -9,7 +9,7 @@ typedef struct {
} PARAMETR; } PARAMETR;
/* Config, EDIT THERE */ /* Config, EDIT THERE */
#define FONT_COLOR "\033[37m" #define FONT_COLOR "\033[1;37m"
#define PC_CHAR "%" #define PC_CHAR "%"
#ifdef _MAIN_H #ifdef _MAIN_H
@ -21,7 +21,7 @@ PARAMETR CONFIG[] = {
{" ARCH ", GetArch}, {" ARCH ", GetArch},
{" SHELL ", GetShell}, {" SHELL ", GetShell},
{" PKGS ", GetPkg}, {" PKGS ", GetPkg},
{" RAM ", GetMem}, {" MEM ", GetMem},
{" ", Blank}, {" ", Blank},
{" COLORS ", PrintColors} {" COLORS ", PrintColors}
}; };

View File

@ -121,7 +121,8 @@ int GetUser(const char *title, const FETCH fetch) {
int GetUptime(const char *title, const FETCH fetch) { int GetUptime(const char *title, const FETCH fetch) {
#ifdef CLOCK #ifdef CLOCK
struct timespec uptime; struct timespec uptime;
clock_gettime(CLOCK, &uptime); if (clock_gettime(CLOCK, &uptime) == -1)
return 1;
int days = uptime.tv_sec / 86400; int days = uptime.tv_sec / 86400;
int hours = uptime.tv_sec / 3600; int hours = uptime.tv_sec / 3600;

View File

@ -6,20 +6,25 @@
int main(void) { int main(void) {
FETCH fetch = Init(); FETCH fetch = Init();
size_t i; int flag = 0;
size_t i = 0;
for (i = 0; i < sizeof(CONFIG) / sizeof(PARAMETR); i++) { for (i = 0; i < sizeof(CONFIG) / sizeof(PARAMETR); i++) {
if (i < fetch.logo_size) if (i < fetch.logo_size && !flag)
printf("%s", fetch.logo[i]); printf("%s", fetch.logo[i]);
if (i >= fetch.logo_size) if (i >= fetch.logo_size && !flag)
printf("%s", fetch.logo[fetch.logo_size - 1]); printf("%s", fetch.logo[fetch.logo_size - 1]);
if (!CONFIG[i].func(CONFIG[i].title, fetch)) if (!CONFIG[i].func(CONFIG[i].title, fetch)) {
flag = 0;
printf("\033[0m\n"); printf("\033[0m\n");
}
else else {
flag = 1;
printf("\033[0m"); printf("\033[0m");
} }
}
for (; i < fetch.logo_size; i++) for (; i < fetch.logo_size; i++)
printf("%s\n", fetch.logo[i]); printf("%s\n", fetch.logo[i]);