fix
This commit is contained in:
parent
dfa1d3ad24
commit
519d0b1e5d
33
src/fetch.c
33
src/fetch.c
@ -48,10 +48,37 @@ int GetOs(char *os_name, size_t len) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetArt(FETCH *fetch, size_t size, char *pkg_cmd, char **logo, char *color) {
|
||||||
|
fetch->logo_size = size;
|
||||||
|
fetch->logo = logo;
|
||||||
|
fetch->pkg_cmd = pkg_cmd;
|
||||||
|
fetch->color = color;
|
||||||
|
}
|
||||||
|
|
||||||
void GetArt(FETCH *fetch) {
|
void GetArt(FETCH *fetch) {
|
||||||
fetch->color = "\033[36m";
|
if (strstr(fetch->os_name, "Debian"))
|
||||||
fetch->logo = Unknow;
|
SetArt(fetch, sizeof(Debian) / sizeof(char *), "dpkg -l | tail -n+6 | wc -l", Debian, "\033[0;31m");
|
||||||
fetch->logo_size = sizeof(Unknow) / sizeof(char *);
|
|
||||||
|
else if (strstr(fetch->os_name, "Void"))
|
||||||
|
SetArt(fetch, sizeof(Void) / sizeof(char *), "xbps-query -l | wc -l", Void, "\033[0;32m");
|
||||||
|
|
||||||
|
else if (strstr(fetch->os_name, "Alpine"))
|
||||||
|
SetArt(fetch, sizeof(Alpine) / sizeof(char *), "grep 'P:' /lib/apk/db/installed | wc -l", Alpine, "\033[1;34m");
|
||||||
|
|
||||||
|
else if (strstr(fetch->os_name, "Arch") || strstr(fetch->os_name, "Artix"))
|
||||||
|
SetArt(fetch, sizeof(Arch) / sizeof(char *), "pacman -Qq | wc -l", Arch, "\033[0;34m");
|
||||||
|
|
||||||
|
else if (strstr(fetch->os_name, "PlainOs"))
|
||||||
|
SetArt(fetch, sizeof(PlainOs) / sizeof(char *), NULL, PlainOs, "\033[37m");
|
||||||
|
|
||||||
|
else if (strstr(fetch->os_name, "OpenBSD"))
|
||||||
|
SetArt(fetch, sizeof(OpenBSD) / sizeof(char *), "/bin/ls -1 /var/db/pkg/ | wc -l | tr -d ' '", OpenBSD, "\033[1;33m");
|
||||||
|
|
||||||
|
else if (!chdir("/system"))
|
||||||
|
SetArt(fetch, sizeof(Android) / sizeof(char *), "dpkg -l | tail -n+6 | wc -l", Android, "\033[32m");
|
||||||
|
|
||||||
|
else
|
||||||
|
SetArt(fetch, sizeof(Unknow) / sizeof(char *), NULL, Unknow, "\033[1;36m");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetKernel(const char *title, const FETCH fetch) {
|
void GetKernel(const char *title, const FETCH fetch) {
|
||||||
|
Loading…
Reference in New Issue
Block a user