mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +00:00
tcp-portmon: convert to callbacks.print
This commit is contained in:
parent
d0a2c51f4b
commit
18d2319d73
@ -1774,12 +1774,6 @@ void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(head) {
|
||||
print_tailhead("head", obj, p, p_max_size);
|
||||
}
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
OBJ(tcp_portmon) {
|
||||
tcp_portmon_action(obj, p, p_max_size);
|
||||
}
|
||||
#endif /* TCP_PORT_MONITOR */
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
OBJ(iconv_start) {
|
||||
do_iconv_start(obj);
|
||||
|
@ -1272,6 +1272,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
END OBJ_ARG(tcp_portmon, &tcp_portmon_update, "tcp_portmon: needs arguments")
|
||||
tcp_portmon_init(obj, arg);
|
||||
obj->callbacks.print = &tcp_portmon_action;
|
||||
obj->callbacks.free = &tcp_portmon_free;
|
||||
#endif /* TCP_PORT_MONITOR */
|
||||
END OBJ(entropy_avail, &update_entropy)
|
||||
|
@ -113,13 +113,13 @@ int tcp_portmon_init(struct text_object *obj, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tcp_portmon_action(struct text_object *obj, char *p, int p_max_size)
|
||||
void tcp_portmon_action(struct text_object *obj, char *p, int p_max_size)
|
||||
{
|
||||
struct tcp_port_monitor_data *pmd = obj->data.opaque;
|
||||
tcp_port_monitor_t *p_monitor;
|
||||
|
||||
if (!pmd)
|
||||
return 1;
|
||||
return;
|
||||
|
||||
/* grab a pointer to this port monitor */
|
||||
p_monitor = find_tcp_port_monitor(pmc, pmd->port_range_begin,
|
||||
@ -127,16 +127,14 @@ int tcp_portmon_action(struct text_object *obj, char *p, int p_max_size)
|
||||
|
||||
if (!p_monitor) {
|
||||
snprintf(p, p_max_size, "monitor not found");
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* now grab the text of interest */
|
||||
if (peek_tcp_port_monitor(p_monitor, pmd->item,
|
||||
pmd->connection_index, p, p_max_size) != 0) {
|
||||
snprintf(p, p_max_size, "monitor peek error");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tcp_portmon_update(void)
|
||||
|
@ -39,7 +39,7 @@ struct tcp_port_monitor_data {
|
||||
struct text_object;
|
||||
|
||||
int tcp_portmon_init(struct text_object *, const char *);
|
||||
int tcp_portmon_action(struct text_object *, char *, int);
|
||||
void tcp_portmon_action(struct text_object *, char *, int);
|
||||
void tcp_portmon_update(void);
|
||||
int tcp_portmon_clear(void);
|
||||
int tcp_portmon_set_max_connections(int);
|
||||
|
Loading…
Reference in New Issue
Block a user