Загрузить файлы в «/»

This commit is contained in:
8nlight 2023-10-19 14:02:19 +03:00
parent 9b7c0c1429
commit 47b22c9ffa

52
funcs.h
View File

@ -43,8 +43,9 @@ char *GetOs(void);
void PrintColors(void); void PrintColors(void);
void GetArch(void); void GetArch(void);
void Blank(void); void Blank(void);
LOGO GetArt(void);
void SetArt(LOGO *art, size_t size, char *pkg_cmd, char **logo, char *color);
LOGO GetArt(void);
void Init(void) { void Init(void) {
Os = GetOs(); Os = GetOs();
@ -147,7 +148,7 @@ char *GetOs(void) {
} }
void PrintColors(void) { void PrintColors(void) {
for (int i = 0; i < 7; i++) for (int i = 1; i < 7; i++)
printf("\033[1;3%dm● \033[0;3%dm● \033[0m", i, i); printf("\033[1;3%dm● \033[0;3%dm● \033[0m", i, i);
} }
@ -172,45 +173,32 @@ void Blank(void) {
return; return;
} }
void SetArt(LOGO *art, size_t size, char *pkg_cmd, char **logo, char *color) {
art->size = size;
art->pkg_cmd = pkg_cmd;
art->art = logo;
art->color = color;
}
LOGO GetArt(void) { LOGO GetArt(void) {
LOGO art; LOGO art;
if (Os != NULL) { if (Os != NULL) {
if (strstr(Os, "Debian")) { if (strstr(Os, "Debian"))
art.size = sizeof(Debian) / sizeof(char *); SetArt(&art, sizeof(Debian) / sizeof(char *), "dpkg -l | tail -n+6 | wc -l", Debian, "\033[0;31m");
art.pkg_cmd = "dpkg -l | tail -n+6 | wc -l";
art.art = Debian;
art.color = "\033[0;31m";
}
else if (strstr(Os, "Void")) { else if (strstr(Os, "Void"))
art.size = sizeof(Void) / sizeof(char *); SetArt(&art, sizeof(Void) / sizeof(char *), "xbps-query -l | wc -l", Void, "\033[0;32m");
art.pkg_cmd = "xbps-query -l | wc -l";
art.art = Void;
art.color = "\033[0;32m";
}
else if (strstr(Os, "Alpine")) { else if (strstr(Os, "Alpine"))
art.size = sizeof(Alpine) / sizeof(char *); SetArt(&art, sizeof(Alpine) / sizeof(char *), "grep 'P:' /lib/apk/db/installed | wc -l", Alpine, "\033[1;34m");
art.pkg_cmd = "grep 'P:' /lib/apk/db/installed | wc -l";
art.art = Alpine;
art.color = "\033[1;34m";
}
else if (strstr(Os, "Arch") || strstr(Os, "Artix")) { else if (strstr(Os, "Arch") || strstr(Os, "Artix"))
art.size = sizeof(Arch) / sizeof(char *); SetArt(&art, sizeof(Arch) / sizeof(char *), "pacman -Qq | wc -l", Arch, "\033[0;34m");
art.pkg_cmd = "pacman -Qq | wc -l";
art.art = Arch;
art.color = "\033[0;34m";
}
} }
else { else
art.size = sizeof(Unknow) / sizeof(char *); SetArt(&art, sizeof(Unknow) / sizeof(char *), NULL, Unknow, "\033[1;36m");
art.pkg_cmd = NULL;
art.art = Unknow;
art.color = "\033[1;36m";
}
return art; return art;
} }