Uwufetch now compiles on freebsd, but there is little to no info.
This commit is contained in:
parent
a93be06e0a
commit
b86783c774
2 changed files with 37 additions and 17 deletions
9
Makefile
9
Makefile
|
@ -1,7 +1,7 @@
|
||||||
NAME = uwufetch
|
NAME = uwufetch
|
||||||
FILES = uwufetch.c
|
FILES = uwufetch.c
|
||||||
CFLAGS = -O3
|
CFLAGS = -O3
|
||||||
CFLAGS_DEBUG = -Wall -Wextra
|
CFLAGS_DEBUG = -Wall -Wextra -g -thread
|
||||||
ifeq ($(shell uname), Linux)
|
ifeq ($(shell uname), Linux)
|
||||||
PREFIX = /usr/bin
|
PREFIX = /usr/bin
|
||||||
LIBDIR = /usr/lib
|
LIBDIR = /usr/lib
|
||||||
|
@ -11,9 +11,16 @@ else ifeq ($(shell uname), Darwin)
|
||||||
LIBDIR = /usr/local/lib
|
LIBDIR = /usr/local/lib
|
||||||
MANDIR = /usr/local/share/man/man1
|
MANDIR = /usr/local/share/man/man1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC = cc
|
CC = cc
|
||||||
MAN_COMPILER = pandoc
|
MAN_COMPILER = pandoc
|
||||||
|
|
||||||
|
ifeq ($(shell uname), FreeBSD)
|
||||||
|
CFLAGS += -D__FREEBSD__
|
||||||
|
CFLAGS_DEBUG += -D__FREEBSD__
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
build: $(FILES)
|
build: $(FILES)
|
||||||
$(CC) $(CFLAGS) -o $(NAME) $(FILES)
|
$(CC) $(CFLAGS) -o $(NAME) $(FILES)
|
||||||
|
|
||||||
|
|
23
uwufetch.c
23
uwufetch.c
|
@ -65,8 +65,10 @@ struct package_manager
|
||||||
};
|
};
|
||||||
struct utsname sys_var;
|
struct utsname sys_var;
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
|
#ifdef __linux__
|
||||||
struct sysinfo sys;
|
struct sysinfo sys;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
struct winsize win;
|
struct winsize win;
|
||||||
|
|
||||||
int iscygwin = 0;
|
int iscygwin = 0;
|
||||||
|
@ -342,7 +344,9 @@ void print_info()
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
uptime = uptime_mac();
|
uptime = uptime_mac();
|
||||||
#else
|
#else
|
||||||
|
#ifndef __FREEBSD__
|
||||||
uptime = sys.uptime;
|
uptime = sys.uptime;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
switch (uptime)
|
switch (uptime)
|
||||||
{
|
{
|
||||||
|
@ -422,9 +426,11 @@ void get_info()
|
||||||
while (fgets(line, sizeof(line), host_model_info))
|
while (fgets(line, sizeof(line), host_model_info))
|
||||||
if (sscanf(line, "%[^\n]", host_model))
|
if (sscanf(line, "%[^\n]", host_model))
|
||||||
break;
|
break;
|
||||||
|
#ifndef __FREEBSD__
|
||||||
while (fgets(line, sizeof(line), cpuinfo))
|
while (fgets(line, sizeof(line), cpuinfo))
|
||||||
if (sscanf(line, "Hardware : %[^\n]", cpu_model))
|
if (sscanf(line, "Hardware : %[^\n]", cpu_model))
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (library) // macOS
|
else if (library) // macOS
|
||||||
{
|
{
|
||||||
|
@ -439,7 +445,9 @@ void get_info()
|
||||||
else
|
else
|
||||||
sprintf(version_name, "unknown");
|
sprintf(version_name, "unknown");
|
||||||
}
|
}
|
||||||
|
#ifndef __FREEBSD__
|
||||||
fclose(cpuinfo);
|
fclose(cpuinfo);
|
||||||
|
#endif
|
||||||
gethostname(host, 256);
|
gethostname(host, 256);
|
||||||
sscanf(getenv("SHELL"), "%s", shell);
|
sscanf(getenv("SHELL"), "%s", shell);
|
||||||
if (strlen(shell) > 16)
|
if (strlen(shell) > 16)
|
||||||
|
@ -451,7 +459,9 @@ void get_info()
|
||||||
// system resources
|
// system resources
|
||||||
uname(&sys_var);
|
uname(&sys_var);
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
|
#ifndef __FREEBSD__
|
||||||
sysinfo(&sys); // somehow this function has to be called again in print_info()
|
sysinfo(&sys); // somehow this function has to be called again in print_info()
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
truncate_name(sys_var.release);
|
truncate_name(sys_var.release);
|
||||||
|
@ -897,7 +907,7 @@ void usage(char *arg)
|
||||||
|
|
||||||
void uwu_kernel()
|
void uwu_kernel()
|
||||||
{
|
{
|
||||||
#define KERNEL_TO_UWU(str, original, uwufied) \
|
#define KERNEL_TO_UWU(str, original, uwufied) \
|
||||||
if (strcmp(str, original) == 0) \
|
if (strcmp(str, original) == 0) \
|
||||||
sprintf(str, "%s", uwufied)
|
sprintf(str, "%s", uwufied)
|
||||||
|
|
||||||
|
@ -906,12 +916,14 @@ void uwu_kernel()
|
||||||
char splitted[16][128] = {};
|
char splitted[16][128] = {};
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while((token = strsep(&temp_kernel, " "))) {
|
while ((token = strsep(&temp_kernel, " ")))
|
||||||
|
{
|
||||||
strcpy(splitted[count], token);
|
strcpy(splitted[count], token);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
strcpy(kernel, "");
|
strcpy(kernel, "");
|
||||||
for(int i = 0;i < 16;i++) {
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
|
||||||
// kernel name
|
// kernel name
|
||||||
KERNEL_TO_UWU(splitted[i], "Linux", "Linuwu");
|
KERNEL_TO_UWU(splitted[i], "Linux", "Linuwu");
|
||||||
|
@ -950,10 +962,11 @@ void uwu_kernel()
|
||||||
// Windows
|
// Windows
|
||||||
KERNEL_TO_UWU(splitted[i], "windows", "WinyandOwOws");
|
KERNEL_TO_UWU(splitted[i], "windows", "WinyandOwOws");
|
||||||
|
|
||||||
if(i != 0) strcat(kernel, " ");
|
if (i != 0)
|
||||||
|
strcat(kernel, " ");
|
||||||
strcat(kernel, splitted[i]);
|
strcat(kernel, splitted[i]);
|
||||||
}
|
}
|
||||||
#undef KERNEL_TO_UWU
|
#undef KERNEL_TO_UWU
|
||||||
}
|
}
|
||||||
|
|
||||||
void uwu_name()
|
void uwu_name()
|
||||||
|
|
Loading…
Reference in a new issue