This commit is contained in:
Your Name 2023-11-02 18:00:45 +03:00
parent 208725ee0d
commit 135a196f9a
6 changed files with 16 additions and 86 deletions

View File

@ -3,3 +3,6 @@ CC?=cc
all: all:
$(CC) src/*.c -Iinclude -I. $(CFLAGS) -okfetch $(CC) src/*.c -Iinclude -I. $(CFLAGS) -okfetch
clean:
rm kfetch

View File

@ -14,6 +14,7 @@ typedef struct {
static PARAMETR CONFIG[] = { static PARAMETR CONFIG[] = {
{"Krnl ", GetKernel}, {"Krnl ", GetKernel},
{"User ", GetUser},
{"Os ", PrintOs}, {"Os ", PrintOs},
{" ", Blank}, {" ", Blank},
{" ", PrintColors} {" ", PrintColors}

View File

@ -30,5 +30,6 @@ void GetKernel(const char *title, const FETCH fetch);
void PrintOs(const char *title, const FETCH fetch); void PrintOs(const char *title, const FETCH fetch);
void PrintColors(const char *title, const FETCH fetch); void PrintColors(const char *title, const FETCH fetch);
void Blank(const char *title, const FETCH fetch); void Blank(const char *title, const FETCH fetch);
void GetUser(const char *title, const FETCH fetch);
#endif #endif

View File

@ -1,84 +0,0 @@
#ifndef _LOGOS_H
#define _LOGOS_H
char *Debian[] = {
"\033[31m _____ ",
"\033[31m / __ \\ ",
"\033[31m| / | ",
"\033[31m| \\___` ",
"\033[31m -_ ",
"\033[31m --_ ",
" "
};
char *Void[] = {
"\033[32m _\033[36m________ ",
"\033[32m / \\\033[36m\\ _ \\ ",
"\033[32m| /\\\033[36m\\ \\ | ",
"\033[32m| ( (\033[36m_) ) | ",
"\033[32m| \\_ \\\033[36m\\/ | ",
"\033[32m \\______\\\033[36m\\_/ ",
" "
};
char *Alpine[] = {
"\033[34m /\\ /\\ ",
"\033[34m / \\ \\ ",
"\033[34m / \\ \\ ",
"\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 *Android[] = {
"\033[32m ;, ,; ",
"\033[32m ';,.-----.,;' ",
"\033[32m ,' ', ",
"\033[32m / O O \\ ",
"\033[32m| | ",
"\033[32m'-----------------' ",
" ",
};
char *OpenBSD[] = {
"\033[1;33m _____ ",
"\033[1;33m \\- -/ ",
"\033[1;33m \\_/ \\ ",
"\033[1;33m \\ \033[0mO O\033[1;33m | ",
"\033[1;33m |_ < ) 3 ) ",
"\033[1;33m / \\ / ",
"\033[1;33m /-_____-\\ ",
" "
};
char *PlainOs[] = {
" /U /U ",
"( . .) ",
"*(()()) ",
" "
};
char *Unknow[] = {
"\033[1;36m ___ ",
"\033[1;36m (\033[0m..\033[1;36m | ",
"\033[1;36m (\033[33m<> \033[1;36m| ",
"\033[1;36m / \033[0m__\033[1;36m \\ ",
"\033[1;36m ( \033[0m/ \\\033[1;36m /| ",
"\033[33m_\033[1;36m/ \033[0m\\__/\033[1;36m/_) ",
"\033[1;36m\\/\033[1;36m-____\033[33m\\/ ",
" "
};
#endif

View File

@ -1,7 +1,9 @@
#include <pwd.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include "fetch.h" #include "fetch.h"
#include "config.h" #include "config.h"
@ -74,3 +76,10 @@ void Blank(const char *title, const FETCH fetch) {
printf(""); printf("");
} }
void GetUser(const char *title, const FETCH fetch) {
UNUSED(fetch);
struct passwd *pw = getpwuid(geteuid());
printf("%s%s%s%s", fetch.color, title, fetch.font_color, (pw != 0) ? pw->pw_name : "none");
}

View File

@ -13,12 +13,12 @@ int main(void) {
printf("%s", fetch.logo[fetch.logo_size - 1]); printf("%s", fetch.logo[fetch.logo_size - 1]);
CONFIG[i].func(CONFIG[i].title, fetch); CONFIG[i].func(CONFIG[i].title, fetch);
putchar('\n'); printf("\033[0m\n");
} }
for (; i < fetch.logo_size; i++) for (; i < fetch.logo_size; i++)
printf("%s\n", fetch.logo[i]); printf("%s\n", fetch.logo[i]);
printf("\n\033[0m"); printf("\033[0m\n");
return 0; return 0;
} }