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

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