Merge pull request #193 from kskeigrshi/patch-1
Fix FreeBSD compilation
This commit is contained in:
commit
d6ed9130fb
1 changed files with 6 additions and 3 deletions
|
@ -528,7 +528,7 @@ void write_cache(struct info* user_info) {
|
||||||
user_info->uptime = uptime_apple();
|
user_info->uptime = uptime_apple();
|
||||||
#else
|
#else
|
||||||
#ifdef __FREEBSD__
|
#ifdef __FREEBSD__
|
||||||
uptime = uptime_freebsd();
|
user_info->uptime = uptime_freebsd();
|
||||||
#else
|
#else
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
user_info->uptime = user_info->sys.uptime;
|
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) {
|
int print_cache(struct configuration* config_flags, struct info* user_info) {
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
sysinfo(&user_info->sys); // to get uptime
|
#ifndef __FREEBSD__
|
||||||
|
sysinfo(&user_info->sys); // to get uptime
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
FILE* meminfo;
|
FILE* meminfo;
|
||||||
|
|
||||||
|
@ -982,11 +984,12 @@ struct info get_info()
|
||||||
while (fgets(buffer, sizeof(buffer), cpuinfo)) {
|
while (fgets(buffer, sizeof(buffer), cpuinfo)) {
|
||||||
#ifdef __FREEBSD__
|
#ifdef __FREEBSD__
|
||||||
if (sscanf(buffer, "hw.model: %[^\n]", user_info.cpu_model))
|
if (sscanf(buffer, "hw.model: %[^\n]", user_info.cpu_model))
|
||||||
|
break;
|
||||||
#else
|
#else
|
||||||
if (sscanf(buffer, "model name : %[^\n]", user_info.cpu_model))
|
if (sscanf(buffer, "model name : %[^\n]", user_info.cpu_model))
|
||||||
break;
|
break;
|
||||||
#endif // __FREEBSD__
|
#endif // __FREEBSD__
|
||||||
}
|
}
|
||||||
// getting username
|
// getting username
|
||||||
char* tmp_user = getenv("USER");
|
char* tmp_user = getenv("USER");
|
||||||
if (tmp_user == NULL)
|
if (tmp_user == NULL)
|
||||||
|
|
Loading…
Reference in a new issue