Little fix for previous commit

This commit is contained in:
TheDarkBug 2021-07-21 22:45:16 +02:00
parent b86783c774
commit c0eb27037c
2 changed files with 7 additions and 3 deletions

View file

@ -1,7 +1,7 @@
NAME = uwufetch
FILES = uwufetch.c
CFLAGS = -O3
CFLAGS_DEBUG = -Wall -Wextra -g -thread
CFLAGS_DEBUG = -Wall -Wextra -g -pthread
ifeq ($(shell uname), Linux)
PREFIX = /usr/bin
LIBDIR = /usr/lib
@ -16,8 +16,8 @@ CC = cc
MAN_COMPILER = pandoc
ifeq ($(shell uname), FreeBSD)
CFLAGS += -D__FREEBSD__
CFLAGS_DEBUG += -D__FREEBSD__
CFLAGS += -D__FREEBSD__
CFLAGS_DEBUG += -D__FREEBSD__
endif

View file

@ -378,7 +378,9 @@ void get_info()
// os version, cpu and board info
FILE *os_release = fopen("/etc/os-release", "r");
#ifndef __FREEBSD__
FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
#endif
FILE *host_model_info = fopen("/sys/devices/virtual/dmi/id/product_version", "r");
#ifdef __CYGWIN__
iscygwin = 1;
@ -400,10 +402,12 @@ void get_info()
break;
}
}
#ifndef __FREEBSD__
while (fgets(line, sizeof(line), cpuinfo))
if (sscanf(line, "model name : %[^\n]", cpu_model))
break;
sprintf(user, "%s", getenv("USER"));
#endif
if (iscygwin == 0)
fclose(os_release);
}