From e9dde6293bf63df3399aec276c4214223e4bcd97 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 26 Nov 2009 00:22:25 +0100 Subject: [PATCH] convert nodename to callbacks.print --- src/common.c | 6 ++++++ src/common.h | 1 + src/conky.c | 3 --- src/core.c | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common.c b/src/common.c index 90f95dc3..05fbd474 100644 --- a/src/common.c +++ b/src/common.c @@ -541,3 +541,9 @@ void print_machine(struct text_object *obj, char *p, int p_max_size) (void)obj; snprintf(p, p_max_size, "%s", info.uname_s.machine); } + +void print_nodename(struct text_object *obj, char *p, int p_max_size) +{ + (void)obj; + snprintf(p, p_max_size, "%s", info.uname_s.nodename); +} diff --git a/src/common.h b/src/common.h index 32629e1d..2cf6e1e6 100644 --- a/src/common.h +++ b/src/common.h @@ -88,5 +88,6 @@ uint8_t swap_barval(struct text_object *); void print_kernel(struct text_object *, char *, int); void print_machine(struct text_object *, char *, int); +void print_nodename(struct text_object *, char *, int); #endif /* _COMMON_H */ diff --git a/src/conky.c b/src/conky.c index b0d20aff..f4ab2cbc 100644 --- a/src/conky.c +++ b/src/conky.c @@ -956,9 +956,6 @@ void generate_text_internal(char *p, int p_max_size, DO_JUMP; } } - OBJ(nodename) { - snprintf(p, p_max_size, "%s", cur->uname_s.nodename); - } OBJ(pid_chroot) { char buf[max_user_text]; diff --git a/src/core.c b/src/core.c index 1bbd382f..b419d959 100644 --- a/src/core.c +++ b/src/core.c @@ -828,6 +828,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long extract_variable_text_internal(obj->sub, arg); obj->callbacks.print = &print_format_time; END OBJ(nodename, 0) + obj->callbacks.print = &print_nodename; END OBJ_ARG(cmdline_to_pid, 0, "cmdline_to_pid needs a command line as argument") scan_cmdline_to_pid_arg(obj, arg, free_at_crash); END OBJ_ARG(pid_chroot, 0, "pid_chroot needs a pid as argument")