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

This commit is contained in:
8nlight 2023-08-20 21:59:40 +03:00
parent 69af8be271
commit a3f8da336a
2 changed files with 51 additions and 38 deletions

75
funcs.h
View File

@ -16,7 +16,6 @@
#define CLOCK CLOCK_MONOTONIC
#endif
//Varables
typedef struct {
size_t size;
char *color;
@ -53,7 +52,6 @@ void Init(void) {
}
}
void GetShell(void) {
char *shell = getenv("SHELL");
if (shell == NULL) {
@ -66,7 +64,6 @@ void GetShell(void) {
printf("%s SHELL \033[0;37m%s\033[0m", Logo.color, splt + 1);
}
void GetKernel(void) {
printf("%s KERNEL \033[0;37m%s\033[0m", Logo.color, Uts.release);
}
@ -74,14 +71,13 @@ void GetKernel(void) {
void PrintOs(void) {
if (Os == NULL) {
printf("%s OS \033[0;37m%s\033[0m", Logo.color, Uts.sysname);
printf("%s OS \033[0;37m%s\033[0m", Logo.color, Uts.sysname);
return;
}
printf("%s OS \033[0;37m%s\033[0m", Logo.color, Os + strlen("PRETTY_NAME= "));
}
void GetUptime(void) {
#ifdef CLOCK
struct timespec uptime;
@ -98,13 +94,11 @@ void GetUptime(void) {
#endif
}
void GetUser(void) {
struct passwd *pw = getpwuid(geteuid());
printf("%s USER \033[0;37m%s\033[0m", Logo.color, pw->pw_name);
}
void GetPkgs(void) {
if (Logo.pkg_cmd == NULL) {
printf("%s PKGS \033[0;37m0", Logo.color);
@ -121,7 +115,6 @@ void GetPkgs(void) {
pclose(fp);
}
char *GetOs(void) {
FILE *fp = fopen("/etc/os-release", "r");
if (fp == NULL)
@ -140,60 +133,68 @@ char *GetOs(void) {
return line;
}
}
//EOF
free(line);
}
return NULL;
}
void PrintColors(void) {
printf(" ");
printf(" ");
for (int i = 0; i < 7; i++)
printf("\033[1;3%dm● \033[0;3%dm● \033[0m", i, i);
}
void GetArch(void) {
printf("%s ARCH \033[0;37m%s", Logo.color, Uts.machine);
}
void Blank(void) {
return;
}
LOGO GetArt(void) {
LOGO art;
//Else
art.size = sizeof(Unknow) / sizeof(char *);
art.pkg_cmd = NULL;
art.art = Unknow;
art.color = "\033[1;35m";
if (Os == NULL)
return 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";
}
else 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";
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, "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, "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, "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, "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 {
art.size = sizeof(Unknow) / sizeof(char *);
art.pkg_cmd = NULL;
art.art = Unknow;
art.color = "\033[1;36m";
}
return art;
}

14
logos.h
View File

@ -25,10 +25,22 @@ char *Alpine[] = {
"\033[34m / \\ \\ ",
"\033[34m/ \\ \\ ",
"\033[34m \\ ",
" "
" "
};
char *Arch[] = {
"\033[1;34m /\\ ",
"\033[1;34m / \\ ",
"\033[1;34m /\\ \\ ",
"\033[1;34m / \\ ",
"\033[1;34m / ,, \\ ",
"\033[1;34m / | | -\\ ",
"\033[1;34m/_-'' ''-_\\",
" "
};
char *Unknow[] = {
" ",
"\033[35m ___ ",
"\033[35m (\033[0m..\033[35m | ",
"\033[35m (\033[33m<> \033[35m| ",