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

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

41
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);
}
@ -81,7 +78,6 @@ void PrintOs(void) {
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,41 +133,33 @@ char *GetOs(void) {
return line;
}
}
//EOF
free(line);
}
return NULL;
}
void PrintColors(void) {
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;
else if (strstr(Os, "Debian")) {
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;
@ -195,5 +180,21 @@ LOGO GetArt(void) {
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 {
art.size = sizeof(Unknow) / sizeof(char *);
art.pkg_cmd = NULL;
art.art = Unknow;
art.color = "\033[1;36m";
}
return art;
}

12
logos.h
View File

@ -28,7 +28,19 @@ char *Alpine[] = {
" "
};
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| ",