mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Build fix for macOS. (#574)
This commit is contained in:
parent
0a9a46dd70
commit
a78a750dad
70
src/core.cc
70
src/core.cc
@ -31,7 +31,6 @@
|
||||
#include "algebra.h"
|
||||
#include "bsdapm.h"
|
||||
#include "build.h"
|
||||
#include "misc.h"
|
||||
#include "colours.h"
|
||||
#include "combine.h"
|
||||
#include "core.h"
|
||||
@ -39,6 +38,7 @@
|
||||
#include "entropy.h"
|
||||
#include "exec.h"
|
||||
#include "i8k.h"
|
||||
#include "misc.h"
|
||||
#include "text_object.h"
|
||||
#ifdef BUILD_IMLIB2
|
||||
#include "imlib2.h"
|
||||
@ -74,6 +74,8 @@
|
||||
#ifdef BUILD_NVIDIA
|
||||
#include "nvidia.h"
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#include "cpu.h"
|
||||
#include "read_tcpip.h"
|
||||
#include "scroll.h"
|
||||
#include "specials.h"
|
||||
@ -84,8 +86,6 @@
|
||||
#include "top.h"
|
||||
#include "user.h"
|
||||
#include "users.h"
|
||||
#include <inttypes.h>
|
||||
#include "cpu.h"
|
||||
#ifdef BUILD_CURL
|
||||
#include "ccurl_thread.h"
|
||||
#endif /* BUILD_CURL */
|
||||
@ -427,8 +427,9 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
#endif /* !__OpenBSD__ */
|
||||
END OBJ(freq, nullptr) get_cpu_count();
|
||||
if ((arg == nullptr) || (isdigit((unsigned char)arg[0]) == 0) || strlen(arg) >= 3 ||
|
||||
atoi(&arg[0]) == 0 || atoi(&arg[0]) > info.cpu_count) {
|
||||
if ((arg == nullptr) || (isdigit((unsigned char)arg[0]) == 0) ||
|
||||
strlen(arg) >= 3 || atoi(&arg[0]) == 0 ||
|
||||
atoi(&arg[0]) > info.cpu_count) {
|
||||
obj->data.i = 1;
|
||||
/* NORM_ERR("freq: Invalid CPU number or you don't have that many CPUs! "
|
||||
"Displaying the clock for CPU 1."); */
|
||||
@ -437,8 +438,9 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
}
|
||||
obj->callbacks.print = &print_freq;
|
||||
END OBJ(freq_g, nullptr) get_cpu_count();
|
||||
if ((arg == nullptr) || (isdigit((unsigned char)arg[0]) == 0) || strlen(arg) >= 3 ||
|
||||
atoi(&arg[0]) == 0 || atoi(&arg[0]) > info.cpu_count) {
|
||||
if ((arg == nullptr) || (isdigit((unsigned char)arg[0]) == 0) ||
|
||||
strlen(arg) >= 3 || atoi(&arg[0]) == 0 ||
|
||||
atoi(&arg[0]) > info.cpu_count) {
|
||||
obj->data.i = 1;
|
||||
/* NORM_ERR("freq_g: Invalid CPU number or you don't have that many "
|
||||
"CPUs! Displaying the clock for CPU 1."); */
|
||||
@ -463,8 +465,8 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
obj->callbacks.free = &free_tcp_ping;
|
||||
#if defined(__linux__)
|
||||
END OBJ(voltage_mv, 0) get_cpu_count();
|
||||
if (!arg || !isdigit((unsigned char)arg[0]) || strlen(arg) >= 3 || atoi(&arg[0]) == 0 ||
|
||||
atoi(&arg[0]) > info.cpu_count) {
|
||||
if (!arg || !isdigit((unsigned char)arg[0]) || strlen(arg) >= 3 ||
|
||||
atoi(&arg[0]) == 0 || atoi(&arg[0]) > info.cpu_count) {
|
||||
obj->data.i = 1;
|
||||
/* NORM_ERR("voltage_mv: Invalid CPU number or you don't have that many "
|
||||
"CPUs! Displaying voltage for CPU 1."); */
|
||||
@ -473,8 +475,8 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
}
|
||||
obj->callbacks.print = &print_voltage_mv;
|
||||
END OBJ(voltage_v, 0) get_cpu_count();
|
||||
if (!arg || !isdigit((unsigned char)arg[0]) || strlen(arg) >= 3 || atoi(&arg[0]) == 0 ||
|
||||
atoi(&arg[0]) > info.cpu_count) {
|
||||
if (!arg || !isdigit((unsigned char)arg[0]) || strlen(arg) >= 3 ||
|
||||
atoi(&arg[0]) == 0 || atoi(&arg[0]) > info.cpu_count) {
|
||||
obj->data.i = 1;
|
||||
/* NORM_ERR("voltage_v: Invalid CPU number or you don't have that many "
|
||||
"CPUs! Displaying voltage for CPU 1."); */
|
||||
@ -781,12 +783,10 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
END OBJ(conky_build_date, nullptr) obj_be_plain_text(obj, BUILD_DATE);
|
||||
END OBJ(conky_build_arch, nullptr) obj_be_plain_text(obj, BUILD_ARCH);
|
||||
END OBJ(downspeed, &update_net_stats)
|
||||
update_gateway_info();
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
obj->callbacks.print = &print_downspeed;
|
||||
END OBJ(downspeedf, &update_net_stats)
|
||||
update_gateway_info();
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
obj->callbacks.print = &print_downspeedf;
|
||||
#ifdef BUILD_X11
|
||||
END OBJ(downspeedgraph, &update_net_stats)
|
||||
@ -815,41 +815,35 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
scan_no_update(obj, arg);
|
||||
obj->callbacks.print = &print_no_update;
|
||||
obj->callbacks.free = &free_no_update;
|
||||
END OBJ(cat, 0)
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size.get(*state));
|
||||
END OBJ(cat, 0) obj->data.s =
|
||||
strndup(arg ? arg : "", text_buffer_size.get(*state));
|
||||
obj->callbacks.print = &print_cat;
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
|
||||
#ifdef BUILD_X11
|
||||
END OBJ(num_led, 0)
|
||||
obj->callbacks.print = &print_num_led;
|
||||
END OBJ(caps_led, 0)
|
||||
obj->callbacks.print = &print_caps_led;
|
||||
END OBJ(scroll_led, 0)
|
||||
obj->callbacks.print = &print_scroll_led;
|
||||
END OBJ(kb_layout, 0)
|
||||
obj->callbacks.print = &print_kb_layout;
|
||||
END OBJ(mouse_speed, 0)
|
||||
obj->callbacks.print = &print_mouse_speed;
|
||||
END OBJ(num_led, 0) obj->callbacks.print = &print_num_led;
|
||||
END OBJ(caps_led, 0) obj->callbacks.print = &print_caps_led;
|
||||
END OBJ(scroll_led, 0) obj->callbacks.print = &print_scroll_led;
|
||||
END OBJ(kb_layout, 0) obj->callbacks.print = &print_kb_layout;
|
||||
END OBJ(mouse_speed, 0) obj->callbacks.print = &print_mouse_speed;
|
||||
#endif /* BUILD_X11 */
|
||||
|
||||
END OBJ(password, 0)
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size.get(*state));
|
||||
END OBJ(password, 0) obj->data.s =
|
||||
strndup(arg ? arg : "", text_buffer_size.get(*state));
|
||||
obj->callbacks.print = &print_password;
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
|
||||
#ifdef __x86_64__
|
||||
END OBJ(freq2, 0)
|
||||
obj->callbacks.print = &print_freq2;
|
||||
END OBJ(freq2, 0) obj->callbacks.print = &print_freq2;
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
END OBJ(cap, 0)
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size.get(*state));
|
||||
END OBJ(cap, 0) obj->data.s =
|
||||
strndup(arg ? arg : "", text_buffer_size.get(*state));
|
||||
obj->callbacks.print = &print_cap;
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
|
||||
END OBJ(catp, 0)
|
||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size.get(*state));
|
||||
END OBJ(catp, 0) obj->data.s =
|
||||
strndup(arg ? arg : "", text_buffer_size.get(*state));
|
||||
obj->callbacks.print = &print_catp;
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
END OBJ_ARG(exec, nullptr, "exec needs arguments: <command>")
|
||||
@ -1407,12 +1401,10 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
END OBJ(alignc, nullptr) obj->data.l = arg != nullptr ? atoi(arg) : 0;
|
||||
obj->callbacks.print = &new_alignc;
|
||||
END OBJ(upspeed, &update_net_stats)
|
||||
update_gateway_info();
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
obj->callbacks.print = &print_upspeed;
|
||||
END OBJ(upspeedf, &update_net_stats)
|
||||
update_gateway_info();
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
obj->callbacks.print = &print_upspeedf;
|
||||
#ifdef BUILD_X11
|
||||
END OBJ(upspeedgraph, &update_net_stats)
|
||||
|
@ -360,6 +360,7 @@ void print_gateway_ip(struct text_object *obj, char *p, int p_max_size) {
|
||||
* if some error happened
|
||||
**/
|
||||
int update_net_stats(void) {
|
||||
update_gateway_info();
|
||||
FILE *net_dev_fp;
|
||||
static int rep = 0;
|
||||
/* variably to notify the parts averaging the download speed, that this
|
||||
|
Loading…
Reference in New Issue
Block a user