Fix FreeBSD compilation

This commit is contained in:
Кейсуке Игараси 2022-03-18 19:17:08 +09:00 committed by GitHub
parent de1d86f950
commit 784c0497ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,8 +682,10 @@ void print_ascii(struct info* user_info) {
int print_cache(struct configuration* config_flags, struct info* user_info) {
#ifndef __APPLE__
#ifndef _WIN32
#ifndef __FREEBSD__
sysinfo(&user_info->sys); // to get uptime
#endif
#endif
FILE* meminfo;
#ifdef __FREEBSD__
@ -982,6 +984,7 @@ 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;