From 784c0497ae19e4beb1312dfd3bcc6e126b727a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B5=D0=B9=D1=81=D1=83=D0=BA=D0=B5=20=D0=98=D0=B3?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=81=D0=B8?= Date: Fri, 18 Mar 2022 19:17:08 +0900 Subject: [PATCH] Fix FreeBSD compilation --- uwufetch.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/uwufetch.c b/uwufetch.c index 8ebadd9..86a7798 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -528,7 +528,7 @@ void write_cache(struct info* user_info) { user_info->uptime = uptime_apple(); #else #ifdef __FREEBSD__ - uptime = uptime_freebsd(); + user_info->uptime = uptime_freebsd(); #else #ifndef _WIN32 user_info->uptime = user_info->sys.uptime; @@ -682,7 +682,9 @@ void print_ascii(struct info* user_info) { int print_cache(struct configuration* config_flags, struct info* user_info) { #ifndef __APPLE__ #ifndef _WIN32 - sysinfo(&user_info->sys); // to get uptime + #ifndef __FREEBSD__ + sysinfo(&user_info->sys); // to get uptime + #endif #endif FILE* meminfo; @@ -982,11 +984,12 @@ struct info get_info() while (fgets(buffer, sizeof(buffer), cpuinfo)) { #ifdef __FREEBSD__ if (sscanf(buffer, "hw.model: %[^\n]", user_info.cpu_model)) + break; #else if (sscanf(buffer, "model name : %[^\n]", user_info.cpu_model)) break; #endif // __FREEBSD__ - } + } // getting username char* tmp_user = getenv("USER"); if (tmp_user == NULL)