Загрузить файлы в «/»
This commit is contained in:
parent
9b7c0c1429
commit
47b22c9ffa
52
funcs.h
52
funcs.h
@ -43,8 +43,9 @@ char *GetOs(void);
|
||||
void PrintColors(void);
|
||||
void GetArch(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) {
|
||||
Os = GetOs();
|
||||
@ -147,7 +148,7 @@ char *GetOs(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);
|
||||
}
|
||||
|
||||
@ -172,45 +173,32 @@ void Blank(void) {
|
||||
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 art;
|
||||
|
||||
if (Os != NULL) {
|
||||
if (strstr(Os, "Debian")) {
|
||||
art.size = sizeof(Debian) / sizeof(char *);
|
||||
art.pkg_cmd = "dpkg -l | tail -n+6 | wc -l";
|
||||
art.art = Debian;
|
||||
art.color = "\033[0;31m";
|
||||
}
|
||||
if (strstr(Os, "Debian"))
|
||||
SetArt(&art, sizeof(Debian) / sizeof(char *), "dpkg -l | tail -n+6 | wc -l", Debian, "\033[0;31m");
|
||||
|
||||
else if (strstr(Os, "Void")) {
|
||||
art.size = sizeof(Void) / sizeof(char *);
|
||||
art.pkg_cmd = "xbps-query -l | wc -l";
|
||||
art.art = Void;
|
||||
art.color = "\033[0;32m";
|
||||
}
|
||||
else if (strstr(Os, "Void"))
|
||||
SetArt(&art, sizeof(Void) / sizeof(char *), "xbps-query -l | wc -l", Void, "\033[0;32m");
|
||||
|
||||
else if (strstr(Os, "Alpine")) {
|
||||
art.size = sizeof(Alpine) / sizeof(char *);
|
||||
art.pkg_cmd = "grep 'P:' /lib/apk/db/installed | wc -l";
|
||||
art.art = Alpine;
|
||||
art.color = "\033[1;34m";
|
||||
}
|
||||
else if (strstr(Os, "Alpine"))
|
||||
SetArt(&art, sizeof(Alpine) / sizeof(char *), "grep 'P:' /lib/apk/db/installed | wc -l", Alpine, "\033[1;34m");
|
||||
|
||||
else if (strstr(Os, "Arch") || strstr(Os, "Artix")) {
|
||||
art.size = sizeof(Arch) / sizeof(char *);
|
||||
art.pkg_cmd = "pacman -Qq | wc -l";
|
||||
art.art = Arch;
|
||||
art.color = "\033[0;34m";
|
||||
}
|
||||
else if (strstr(Os, "Arch") || strstr(Os, "Artix"))
|
||||
SetArt(&art, sizeof(Arch) / sizeof(char *), "pacman -Qq | wc -l", Arch, "\033[0;34m");
|
||||
}
|
||||
|
||||
else {
|
||||
art.size = sizeof(Unknow) / sizeof(char *);
|
||||
art.pkg_cmd = NULL;
|
||||
art.art = Unknow;
|
||||
art.color = "\033[1;36m";
|
||||
}
|
||||
else
|
||||
SetArt(&art, sizeof(Unknow) / sizeof(char *), NULL, Unknow, "\033[1;36m");
|
||||
|
||||
return art;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user