This commit is contained in:
Your Name 2024-06-07 14:41:51 +03:00
parent 76e0dcb8ed
commit 4fdee929ee
10 changed files with 149 additions and 329 deletions

View file

@ -1,53 +1,47 @@
#ifndef _FETCH_H
#define _FETCH_H
#include <time.h>
#include <sys/utsname.h>
#include "structs.h"
#ifdef _FETCH_C
#include <time.h>
#if defined(CLOCK_BOOTTIME)
#define CLOCK CLOCK_BOOTTIME
#elif defined(CLOCK_UPTIME)
#define CLOCK CLOCK_UPTIME
#elif defined(__APPLE__)
#define CLOCK CLOCK_MONOTONIC
#endif
#if defined(CLOCK_BOOTTIME)
#define CLOCK CLOCK_BOOTTIME
#elif defined(CLOCK_UPTIME)
#define CLOCK CLOCK_UPTIME
#elif defined(__APPLE__)
#define CLOCK CLOCK_MONOTONIC
#define MODEL_BUFF_SIZE 512
static const char *MODELS[] = {
"/sys/devices/virtual/dmi/id/product_name",
"/sys/devices/virtual/dmi/id/product_version",
"/sys/firmware/devicetree/base/model"
};
#endif
#define OS_SIZE 128
#define MODEL_BUFF_SIZE 512
static const char *MODELS[] = {
"/sys/devices/virtual/dmi/id/product_name",
"/sys/devices/virtual/dmi/id/product_version",
"/sys/firmware/devicetree/base/model"
};
typedef struct {
char os_name[OS_SIZE + 1];
struct utsname uts;
char *pkg_cmd;
char *color;
char *font_color;
size_t logo_size;
char **logo;
} FETCH;
FETCH Init(void);
#if defined(_FETCH_C) || defined(_MAIN_C)
int GetOs(char *os_name, size_t len);
void GetArt(FETCH *fetch, int flag);
int GetKernel(const char *title, const FETCH fetch);
int PrintOs(const char *title, const FETCH fetch);
int Blank(const char *title, const FETCH fetch);
int GetUser(const char *title, const FETCH fetch);
int GetUptime(const char *title, const FETCH fetch);
int GetArch(const char *title, const FETCH fetch);
int GetShell(const char *title, const FETCH fetch);
int GetPkg(const char *title, const FETCH fetch);
int GetMem(const char *title, const FETCH fetch);
int GetModel(const char *title, const FETCH fetch);
int GetHostname(const char *title, const FETCH fetch);
int GetAVG(const char *title, const FETCH fetch);
int GetBattery(const char *title, const FETCH fetch);
int Execute(const char *title, const FETCH fetch);
int eBlank(const char *title, const FETCH fetch);
FETCH Init(void);
#endif
#if defined(_CONFIG_C) || defined(_MAIN_C)
int GetKernel(const struct par par, const FETCH fetch);
int PrintOs(const struct par par, const FETCH fetch);
int Blank(const struct par par, const FETCH fetch);
int GetUser(const struct par par, const FETCH fetch);
int GetUptime(const struct par par, const FETCH fetch);
int GetArch(const struct par par, const FETCH fetch);
int GetShell(const struct par par, const FETCH fetch);
int GetPkg(const struct par par, const FETCH fetch);
int GetMem(const struct par par, const FETCH fetch);
int GetModel(const struct par par, const FETCH fetch);
int GetHostname(const struct par par, const FETCH fetch);
int GetAVG(const struct par par, const FETCH fetch);
int Execute(const struct par par, const FETCH fetch);
int eBlank(const struct par par, const FETCH fetch);
#endif
#endif

View file

@ -69,14 +69,23 @@ char *OpenBSD[] = {
" "
};
char *PlainOs[] = {
" ",
" (\\(\\ ",
" j . .) ",
" | ° ! ",
" ? ; ",
" c?\".UJ ",
" "
char *Manana[] = {
"\033[1;32m -: \033[0m",
"\033[1;32m =* .*: \033[0m",
"\033[1;32m =*=. \033[1;31m:+* =\033[1;32m *** \033[0m",
"\033[1;32m -*+.- \033[1;31m*****#\033[1;32m =*-*- \033[0m",
"\033[1;32m .**:.= \033[1;31m****-\033[1;32m .*:.** \033[0m",
"\033[1;32m +** :* \033[1;31m==:\033[1;32m *+ .**: \033[0m",
"\033[1;32m :**+ -* =*: :**= \033[0m",
"\033[1;32m +**: -*. .*+ .**= \033[0m",
"\033[1;32m .**+ -*- +*. .**= \033[0m",
"\033[1;32m -**: -*= =*- +*= \033[0m",
"\033[1;32m +*+ :*+ .*= =*- \033[0m",
"\033[1;32m .**. ** *= :*: \033[0m",
"\033[1;32m -*: :*. == *. \033[0m",
"\033[1;32m +- +- := +. \033[0m",
"\033[1;32m .- .= .- : \033[0m",
"\033[1;32m :.. \033[0m"
};
char *Ubuntu[] = {

30
include/structs.h Normal file
View file

@ -0,0 +1,30 @@
#ifndef _STRUCTS_H
#define _STRUCTS_H
#include <sys/utsname.h>
#define OS_SIZE 128
typedef struct {
char os_name[OS_SIZE + 1];
struct utsname uts;
char *pkg_cmd;
char *color;
size_t logo_size;
char **logo;
} FETCH;
struct par {
char *str0;
char *str1;
char *str2;
int error_flag;
};
typedef struct {
int (*func)(const struct par par, const FETCH fetch);
struct par par;
} PARAMETR;
#endif