2010-01-07 03:45:19 +00:00
|
|
|
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
|
|
|
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
|
2009-08-05 22:46:51 +00:00
|
|
|
*
|
|
|
|
* Conky, a system monitor, based on torsmo
|
|
|
|
*
|
|
|
|
* Any original torsmo code is licensed under the BSD license
|
|
|
|
*
|
|
|
|
* All code written since the fork of torsmo is licensed under the GPL
|
|
|
|
*
|
|
|
|
* Please see COPYING for details
|
|
|
|
*
|
|
|
|
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
|
2010-01-01 23:46:17 +00:00
|
|
|
* Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
|
2009-08-05 22:46:51 +00:00
|
|
|
* (see AUTHORS)
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/* local headers */
|
2009-08-05 22:46:51 +00:00
|
|
|
#include "core.h"
|
|
|
|
#include "text_object.h"
|
2009-08-07 07:24:24 +00:00
|
|
|
#include "algebra.h"
|
|
|
|
#include "build.h"
|
2009-11-29 13:14:06 +00:00
|
|
|
#include "bsdapm.h"
|
2009-08-07 07:24:24 +00:00
|
|
|
#include "colours.h"
|
2009-10-17 14:14:25 +00:00
|
|
|
#include "combine.h"
|
2009-08-07 07:24:24 +00:00
|
|
|
#include "diskio.h"
|
2009-11-12 22:50:17 +00:00
|
|
|
#include "entropy.h"
|
2009-10-15 19:51:21 +00:00
|
|
|
#include "exec.h"
|
2009-11-16 19:58:26 +00:00
|
|
|
#include "i8k.h"
|
2009-11-28 21:45:01 +00:00
|
|
|
#include "imlib2.h"
|
2009-11-11 09:55:25 +00:00
|
|
|
#include "proc.h"
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
#include "fonts.h"
|
|
|
|
#endif
|
|
|
|
#include "fs.h"
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_IBM
|
2009-12-17 21:11:42 +00:00
|
|
|
#include "ibm.h"
|
|
|
|
#include "smapi.h"
|
|
|
|
#endif
|
2009-10-03 18:01:33 +00:00
|
|
|
#ifdef HAVE_ICONV
|
|
|
|
#include "iconv_tools.h"
|
|
|
|
#endif
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_LUA
|
2009-12-28 20:05:40 +00:00
|
|
|
#include "llua.h"
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_LUA */
|
2009-08-07 07:24:24 +00:00
|
|
|
#include "logging.h"
|
|
|
|
#include "mixer.h"
|
|
|
|
#include "mail.h"
|
|
|
|
#include "mboxscan.h"
|
2009-10-17 14:43:12 +00:00
|
|
|
#include "net_stat.h"
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_NVIDIA
|
2009-10-03 14:14:23 +00:00
|
|
|
#include "nvidia.h"
|
|
|
|
#endif
|
2009-10-17 13:47:06 +00:00
|
|
|
#include "read_tcp.h"
|
2009-10-06 23:04:32 +00:00
|
|
|
#include "scroll.h"
|
2009-08-07 07:24:24 +00:00
|
|
|
#include "specials.h"
|
|
|
|
#include "temphelper.h"
|
2009-09-03 21:53:20 +00:00
|
|
|
#include "template.h"
|
2009-08-07 07:24:24 +00:00
|
|
|
#include "tailhead.h"
|
2009-10-03 15:46:59 +00:00
|
|
|
#include "timeinfo.h"
|
2009-08-07 07:24:24 +00:00
|
|
|
#include "top.h"
|
2009-11-29 15:40:23 +00:00
|
|
|
#include "user.h"
|
2009-11-25 23:51:19 +00:00
|
|
|
#include "users.h"
|
2009-08-07 07:24:24 +00:00
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_NCURSES
|
2009-10-03 18:01:33 +00:00
|
|
|
#include <ncurses.h>
|
|
|
|
#endif
|
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/* check for OS and include appropriate headers */
|
|
|
|
#if defined(__linux__)
|
|
|
|
#include "linux.h"
|
|
|
|
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
|
|
|
#include "freebsd.h"
|
|
|
|
#elif defined(__OpenBSD__)
|
|
|
|
#include "openbsd.h"
|
|
|
|
#endif
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/* strip a leading /dev/ if any, following symlinks first
|
|
|
|
*
|
|
|
|
* BEWARE: this function returns a pointer to static content
|
|
|
|
* which gets overwritten in consecutive calls. I.e.:
|
|
|
|
* this function is NOT reentrant.
|
|
|
|
*/
|
2009-10-17 14:43:12 +00:00
|
|
|
const char *dev_name(const char *path)
|
2009-08-07 07:24:24 +00:00
|
|
|
{
|
|
|
|
static char buf[255]; /* should be enough for pathnames */
|
|
|
|
ssize_t buflen;
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
if (!path)
|
|
|
|
return NULL;
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
#define DEV_NAME(x) \
|
|
|
|
x != NULL && strlen(x) > 5 && strncmp(x, "/dev/", 5) == 0 ? x + 5 : x
|
|
|
|
if ((buflen = readlink(path, buf, 254)) == -1)
|
|
|
|
return DEV_NAME(path);
|
|
|
|
buf[buflen] = '\0';
|
|
|
|
return DEV_NAME(buf);
|
|
|
|
#undef DEV_NAME
|
|
|
|
}
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
static struct text_object *new_text_object_internal(void)
|
2009-08-05 22:46:51 +00:00
|
|
|
{
|
2009-12-10 04:05:32 +00:00
|
|
|
struct text_object *obj = (text_object*)malloc(sizeof(struct text_object));
|
2009-08-07 07:24:24 +00:00
|
|
|
memset(obj, 0, sizeof(struct text_object));
|
|
|
|
return obj;
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
static struct text_object *create_plain_text(const char *s)
|
|
|
|
{
|
|
|
|
struct text_object *obj;
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
if (s == NULL || *s == '\0') {
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
obj = new_text_object_internal();
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-11-29 19:04:55 +00:00
|
|
|
obj_be_plain_text(obj, s);
|
2009-08-07 07:24:24 +00:00
|
|
|
return obj;
|
|
|
|
}
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/* construct_text_object() creates a new text_object */
|
|
|
|
struct text_object *construct_text_object(const char *s, const char *arg, long
|
|
|
|
line, void **ifblock_opaque, void *free_at_crash)
|
2009-08-06 06:54:40 +00:00
|
|
|
{
|
2009-08-07 07:24:24 +00:00
|
|
|
// struct text_object *obj = new_text_object();
|
|
|
|
struct text_object *obj = new_text_object_internal();
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
obj->line = line;
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-09-09 23:35:57 +00:00
|
|
|
/* helper defines for internal use only */
|
|
|
|
#define __OBJ_HEAD(a, n) if (!strcmp(s, #a)) { \
|
2009-12-12 14:47:00 +00:00
|
|
|
add_update_callback(n);
|
2009-09-09 23:35:57 +00:00
|
|
|
#define __OBJ_IF obj_be_ifblock_if(ifblock_opaque, obj)
|
|
|
|
#define __OBJ_ARG(...) if (!arg) { CRIT_ERR(obj, free_at_crash, __VA_ARGS__); }
|
|
|
|
|
|
|
|
/* defines to be used below */
|
|
|
|
#define OBJ(a, n) __OBJ_HEAD(a, n) {
|
|
|
|
#define OBJ_ARG(a, n, ...) __OBJ_HEAD(a, n) __OBJ_ARG(__VA_ARGS__) {
|
|
|
|
#define OBJ_IF(a, n) __OBJ_HEAD(a, n) __OBJ_IF; {
|
|
|
|
#define OBJ_IF_ARG(a, n, ...) __OBJ_HEAD(a, n) __OBJ_ARG(__VA_ARGS__) __OBJ_IF; {
|
2009-08-07 07:24:24 +00:00
|
|
|
#define END } } else
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
if (s[0] == '#') {
|
|
|
|
obj->data.l = get_x11_color(s);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
} else
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-12-13 01:34:29 +00:00
|
|
|
#ifndef __OpenBSD__
|
2009-08-07 07:24:24 +00:00
|
|
|
OBJ(acpitemp, 0)
|
|
|
|
obj->data.i = open_acpi_temperature(arg);
|
2009-11-26 00:38:53 +00:00
|
|
|
obj->callbacks.print = &print_acpitemp;
|
|
|
|
obj->callbacks.free = &free_acpitemp;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(acpiacadapter, 0)
|
2009-11-26 00:51:41 +00:00
|
|
|
obj->callbacks.print = &print_acpiacadapter;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif /* !__OpenBSD__ */
|
2009-12-13 01:34:29 +00:00
|
|
|
END OBJ(freq, 0)
|
2009-08-07 07:24:24 +00:00
|
|
|
get_cpu_count();
|
|
|
|
if (!arg || !isdigit(arg[0]) || strlen(arg) >= 2 || atoi(&arg[0]) == 0
|
2009-10-17 14:55:12 +00:00
|
|
|
|| atoi(&arg[0]) > info.cpu_count) {
|
|
|
|
obj->data.i = 1;
|
2009-08-07 07:24:24 +00:00
|
|
|
/* NORM_ERR("freq: Invalid CPU number or you don't have that many CPUs! "
|
|
|
|
"Displaying the clock for CPU 1."); */
|
|
|
|
} else {
|
2009-10-17 14:55:12 +00:00
|
|
|
obj->data.i = atoi(&arg[0]);
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
2009-11-26 00:42:54 +00:00
|
|
|
obj->callbacks.print = &print_freq;
|
2009-09-06 23:12:11 +00:00
|
|
|
END OBJ(freq_g, 0)
|
2009-08-07 07:24:24 +00:00
|
|
|
get_cpu_count();
|
|
|
|
if (!arg || !isdigit(arg[0]) || strlen(arg) >= 2 || atoi(&arg[0]) == 0
|
2009-10-17 14:55:12 +00:00
|
|
|
|| atoi(&arg[0]) > info.cpu_count) {
|
|
|
|
obj->data.i = 1;
|
2009-08-07 07:24:24 +00:00
|
|
|
/* NORM_ERR("freq_g: Invalid CPU number or you don't have that many "
|
|
|
|
"CPUs! Displaying the clock for CPU 1."); */
|
|
|
|
} else {
|
2009-10-17 14:55:12 +00:00
|
|
|
obj->data.i = atoi(&arg[0]);
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
2009-11-26 00:42:54 +00:00
|
|
|
obj->callbacks.print = &print_freq_g;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(read_tcp, 0, "read_tcp: Needs \"(host) port\" as argument(s)")
|
2009-10-17 13:47:06 +00:00
|
|
|
parse_read_tcp_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_read_tcp;
|
|
|
|
obj->callbacks.free = &free_read_tcp;
|
2009-08-07 07:24:24 +00:00
|
|
|
#if defined(__linux__)
|
|
|
|
END OBJ(voltage_mv, 0)
|
|
|
|
get_cpu_count();
|
|
|
|
if (!arg || !isdigit(arg[0]) || strlen(arg) >= 2 || atoi(&arg[0]) == 0
|
2009-10-17 14:55:12 +00:00
|
|
|
|| atoi(&arg[0]) > info.cpu_count) {
|
|
|
|
obj->data.i = 1;
|
2009-08-07 07:24:24 +00:00
|
|
|
/* NORM_ERR("voltage_mv: Invalid CPU number or you don't have that many "
|
|
|
|
"CPUs! Displaying voltage for CPU 1."); */
|
|
|
|
} else {
|
2009-10-17 14:55:12 +00:00
|
|
|
obj->data.i = atoi(&arg[0]);
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_voltage_mv;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(voltage_v, 0)
|
|
|
|
get_cpu_count();
|
|
|
|
if (!arg || !isdigit(arg[0]) || strlen(arg) >= 2 || atoi(&arg[0]) == 0
|
2009-10-17 14:55:12 +00:00
|
|
|
|| atoi(&arg[0]) > info.cpu_count) {
|
|
|
|
obj->data.i = 1;
|
2009-08-07 07:24:24 +00:00
|
|
|
/* NORM_ERR("voltage_v: Invalid CPU number or you don't have that many "
|
|
|
|
"CPUs! Displaying voltage for CPU 1."); */
|
|
|
|
} else {
|
2009-10-17 14:55:12 +00:00
|
|
|
obj->data.i = atoi(&arg[0]);
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_voltage_v;
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2010-01-11 00:13:42 +00:00
|
|
|
#ifdef BUILD_WLAN
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(wireless_essid, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_wireless_essid;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(wireless_mode, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_wireless_mode;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(wireless_bitrate, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_wireless_bitrate;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(wireless_ap, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_wireless_ap;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(wireless_link_qual, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_wireless_link_qual;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(wireless_link_qual_max, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_wireless_link_qual_max;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(wireless_link_qual_perc, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_wireless_link_qual_perc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(wireless_link_bar, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_bar_arg(obj, arg, free_at_crash);
|
2009-11-22 17:15:36 +00:00
|
|
|
obj->callbacks.barval = &wireless_link_barval;
|
2010-01-11 00:13:42 +00:00
|
|
|
#endif /* BUILD_WLAN */
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif /* __linux__ */
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
#ifndef __OpenBSD__
|
|
|
|
END OBJ(acpifan, 0)
|
2009-11-26 00:51:41 +00:00
|
|
|
obj->callbacks.print = &print_acpifan;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(battery, 0)
|
|
|
|
char bat[64];
|
|
|
|
|
|
|
|
if (arg) {
|
|
|
|
sscanf(arg, "%63s", bat);
|
|
|
|
} else {
|
|
|
|
strcpy(bat, "BAT0");
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
2009-08-07 07:24:24 +00:00
|
|
|
obj->data.s = strndup(bat, text_buffer_size);
|
2009-11-26 00:51:41 +00:00
|
|
|
obj->callbacks.print = &print_battery;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(battery_short, 0)
|
|
|
|
char bat[64];
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
if (arg) {
|
|
|
|
sscanf(arg, "%63s", bat);
|
|
|
|
} else {
|
|
|
|
strcpy(bat, "BAT0");
|
|
|
|
}
|
|
|
|
obj->data.s = strndup(bat, text_buffer_size);
|
2009-11-26 00:51:41 +00:00
|
|
|
obj->callbacks.print = &print_battery_short;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(battery_time, 0)
|
|
|
|
char bat[64];
|
2009-08-05 22:46:51 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
if (arg) {
|
|
|
|
sscanf(arg, "%63s", bat);
|
|
|
|
} else {
|
|
|
|
strcpy(bat, "BAT0");
|
|
|
|
}
|
|
|
|
obj->data.s = strndup(bat, text_buffer_size);
|
2009-11-26 00:51:41 +00:00
|
|
|
obj->callbacks.print = &print_battery_time;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(battery_percent, 0)
|
|
|
|
char bat[64];
|
|
|
|
|
|
|
|
if (arg) {
|
|
|
|
sscanf(arg, "%63s", bat);
|
|
|
|
} else {
|
|
|
|
strcpy(bat, "BAT0");
|
|
|
|
}
|
|
|
|
obj->data.s = strndup(bat, text_buffer_size);
|
2009-11-26 00:51:41 +00:00
|
|
|
obj->callbacks.percentage = &battery_percentage;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(battery_bar, 0)
|
|
|
|
char bat[64];
|
|
|
|
if (arg) {
|
2009-12-04 00:17:47 +00:00
|
|
|
arg = scan_bar(obj, arg, 100);
|
2009-08-07 07:24:24 +00:00
|
|
|
sscanf(arg, "%63s", bat);
|
|
|
|
} else {
|
|
|
|
strcpy(bat, "BAT0");
|
|
|
|
}
|
|
|
|
obj->data.s = strndup(bat, text_buffer_size);
|
2009-11-22 20:54:02 +00:00
|
|
|
obj->callbacks.barval = &get_battery_perct_bar;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif /* !__OpenBSD__ */
|
|
|
|
|
|
|
|
#if defined(__linux__)
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(disk_protect, 0, "disk_protect needs an argument")
|
|
|
|
obj->data.s = strndup(dev_name(arg), text_buffer_size);
|
2009-11-16 00:31:55 +00:00
|
|
|
obj->callbacks.print = &print_disk_protect_queue;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_version, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_version;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_bios, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_bios;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_serial, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_serial;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_cpu_temp, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_cpu_temp;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_left_fan_status, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_left_fan_status;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_right_fan_status, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_right_fan_status;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_left_fan_rpm, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_left_fan_rpm;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_right_fan_rpm, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_right_fan_rpm;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_ac_status, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_ac_status;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(i8k_buttons_status, &update_i8k)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_i8k_buttons_status;
|
2010-01-07 02:38:12 +00:00
|
|
|
#if defined(BUILD_IBM)
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(ibm_fan, 0)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &get_ibm_acpi_fan;
|
2009-10-28 02:54:53 +00:00
|
|
|
END OBJ_ARG(ibm_temps, &get_ibm_acpi_temps, "ibm_temps: needs an argument")
|
2009-10-13 21:01:31 +00:00
|
|
|
parse_ibm_temps_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_ibm_temps;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(ibm_volume, 0)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &get_ibm_acpi_volume;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(ibm_brightness, 0)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &get_ibm_acpi_brightness;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif
|
|
|
|
/* information from sony_laptop kernel module
|
|
|
|
* /sys/devices/platform/sony-laptop */
|
|
|
|
END OBJ(sony_fanspeed, 0)
|
2009-11-15 23:59:39 +00:00
|
|
|
obj->callbacks.print = &get_sony_fanspeed;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ_IF(if_gw, &update_gateway_info)
|
2009-11-16 22:20:58 +00:00
|
|
|
obj->callbacks.iftest = &gateway_exists;
|
2009-11-29 19:52:36 +00:00
|
|
|
obj->callbacks.free = &free_gateway_info;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(ioscheduler, 0, "get_ioscheduler needs an argument (e.g. hda)")
|
|
|
|
obj->data.s = strndup(dev_name(arg), text_buffer_size);
|
2009-11-16 21:27:53 +00:00
|
|
|
obj->callbacks.print = &print_ioscheduler;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(laptop_mode, 0)
|
2009-11-16 00:15:39 +00:00
|
|
|
obj->callbacks.print = &print_laptop_mode;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(pb_battery, 0, "pb_battery: needs one argument: status, percent or time")
|
|
|
|
if (strcmp(arg, "status") == EQUAL) {
|
2009-08-07 07:24:24 +00:00
|
|
|
obj->data.i = PB_BATT_STATUS;
|
2009-09-09 23:35:57 +00:00
|
|
|
} else if (strcmp(arg, "percent") == EQUAL) {
|
2009-08-07 07:24:24 +00:00
|
|
|
obj->data.i = PB_BATT_PERCENT;
|
2009-09-09 23:35:57 +00:00
|
|
|
} else if (strcmp(arg, "time") == EQUAL) {
|
2009-08-07 07:24:24 +00:00
|
|
|
obj->data.i = PB_BATT_TIME;
|
|
|
|
} else {
|
2009-09-09 23:35:57 +00:00
|
|
|
NORM_ERR("pb_battery: illegal argument '%s', defaulting to status", arg);
|
|
|
|
obj->data.i = PB_BATT_STATUS;
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
2009-11-16 00:20:35 +00:00
|
|
|
obj->callbacks.print = get_powerbook_batt_info;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif /* __linux__ */
|
|
|
|
#if (defined(__FreeBSD__) || defined(__linux__))
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_IF_ARG(if_up, 0, "if_up needs an argument")
|
2009-10-09 02:30:02 +00:00
|
|
|
parse_if_up_arg(obj, arg);
|
2009-11-16 22:23:27 +00:00
|
|
|
obj->callbacks.iftest = &interface_up;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_if_up;
|
2009-08-05 22:46:51 +00:00
|
|
|
#endif
|
2009-08-07 07:24:24 +00:00
|
|
|
#if defined(__OpenBSD__)
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(obsd_sensors_temp, 0, "obsd_sensors_temp: needs an argument")
|
2009-10-09 01:55:46 +00:00
|
|
|
parse_obsd_sensor(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_obsd_sensors_temp;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(obsd_sensors_fan, 0, "obsd_sensors_fan: needs 2 arguments (device and sensor number)")
|
2009-10-09 01:55:46 +00:00
|
|
|
parse_obsd_sensor(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_obsd_sensors_fan;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(obsd_sensors_volt, 0, "obsd_sensors_volt: needs 2 arguments (device and sensor number)")
|
2009-10-09 01:55:46 +00:00
|
|
|
parse_obsd_sensor(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_obsd_sensors_volt;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(obsd_vendor, 0)
|
2009-11-16 00:41:53 +00:00
|
|
|
obj->callbacks.print = &get_obsd_vendor;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(obsd_product, 0)
|
2009-11-16 00:41:53 +00:00
|
|
|
obj->callbacks.print = &get_obsd_product;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif /* __OpenBSD__ */
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(buffers, &update_meminfo)
|
2009-11-26 00:10:19 +00:00
|
|
|
obj->callbacks.print = &print_buffers;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(cached, &update_meminfo)
|
2009-11-26 00:10:19 +00:00
|
|
|
obj->callbacks.print = &print_cached;
|
2009-08-07 07:24:24 +00:00
|
|
|
#define SCAN_CPU(__arg, __var) { \
|
|
|
|
int __offset = 0; \
|
2009-10-17 14:55:12 +00:00
|
|
|
if (__arg && sscanf(__arg, " cpu%d %n", &__var, &__offset) > 0) \
|
2009-08-07 07:24:24 +00:00
|
|
|
__arg += __offset; \
|
|
|
|
else \
|
|
|
|
__var = 0; \
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(cpu, &update_cpu_usage)
|
2009-10-17 14:55:12 +00:00
|
|
|
SCAN_CPU(arg, obj->data.i);
|
2009-11-25 00:30:21 +00:00
|
|
|
obj->callbacks.percentage = &cpu_percentage;
|
2009-10-17 14:55:12 +00:00
|
|
|
DBGP2("Adding $cpu for CPU %d", obj->data.i);
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(cpugauge, &update_cpu_usage)
|
2009-10-17 14:55:12 +00:00
|
|
|
SCAN_CPU(arg, obj->data.i);
|
2009-12-04 00:19:07 +00:00
|
|
|
scan_gauge(obj, arg, 1);
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.gaugeval = &cpu_barval;
|
2009-10-17 14:55:12 +00:00
|
|
|
DBGP2("Adding $cpugauge for CPU %d", obj->data.i);
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(cpubar, &update_cpu_usage)
|
2009-10-17 14:55:12 +00:00
|
|
|
SCAN_CPU(arg, obj->data.i);
|
2009-12-04 00:19:07 +00:00
|
|
|
scan_bar(obj, arg, 1);
|
2009-11-22 17:02:56 +00:00
|
|
|
obj->callbacks.barval = &cpu_barval;
|
2009-10-17 14:55:12 +00:00
|
|
|
DBGP2("Adding $cpubar for CPU %d", obj->data.i);
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(cpugraph, &update_cpu_usage)
|
2009-08-07 07:24:24 +00:00
|
|
|
char *buf = 0;
|
2009-10-17 14:55:12 +00:00
|
|
|
SCAN_CPU(arg, obj->data.i);
|
2009-12-04 00:19:07 +00:00
|
|
|
buf = scan_graph(obj, arg, 1);
|
2009-10-17 14:55:12 +00:00
|
|
|
DBGP2("Adding $cpugraph for CPU %d", obj->data.i);
|
2009-08-07 07:24:24 +00:00
|
|
|
if (buf) free(buf);
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.graphval = &cpu_barval;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(loadgraph, &update_load_average)
|
2009-10-25 12:49:10 +00:00
|
|
|
scan_loadgraph_arg(obj, arg);
|
2009-11-23 23:24:17 +00:00
|
|
|
obj->callbacks.graphval = &loadgraphval;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(diskio, &update_diskio)
|
2009-10-07 20:44:17 +00:00
|
|
|
parse_diskio_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_diskio;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(diskio_read, &update_diskio)
|
2009-10-07 20:44:17 +00:00
|
|
|
parse_diskio_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_diskio_read;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(diskio_write, &update_diskio)
|
2009-10-07 20:44:17 +00:00
|
|
|
parse_diskio_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_diskio_write;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(diskiograph, &update_diskio)
|
2009-10-07 20:44:17 +00:00
|
|
|
parse_diskiograph_arg(obj, arg);
|
2009-11-23 23:17:52 +00:00
|
|
|
obj->callbacks.graphval = &diskiographval;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(diskiograph_read, &update_diskio)
|
2009-10-07 20:44:17 +00:00
|
|
|
parse_diskiograph_arg(obj, arg);
|
2009-11-23 23:17:52 +00:00
|
|
|
obj->callbacks.graphval = &diskiographval_read;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(diskiograph_write, &update_diskio)
|
2009-10-07 20:44:17 +00:00
|
|
|
parse_diskiograph_arg(obj, arg);
|
2009-11-23 23:17:52 +00:00
|
|
|
obj->callbacks.graphval = &diskiographval_write;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color, 0)
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
if (output_methods & TO_X) {
|
|
|
|
obj->data.l = arg ? get_x11_color(arg) : default_fg_color;
|
|
|
|
set_current_text_color(obj->data.l);
|
|
|
|
}
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
|
|
|
#ifdef BUILD_NCURSES
|
2009-08-07 07:24:24 +00:00
|
|
|
if (output_methods & TO_NCURSES) {
|
|
|
|
obj->data.l = COLOR_WHITE;
|
|
|
|
if(arg) {
|
|
|
|
if(strcasecmp(arg, "red") == 0) {
|
|
|
|
obj->data.l = COLOR_RED;
|
|
|
|
}else if(strcasecmp(arg, "green") == 0) {
|
|
|
|
obj->data.l = COLOR_GREEN;
|
|
|
|
}else if(strcasecmp(arg, "yellow") == 0) {
|
|
|
|
obj->data.l = COLOR_YELLOW;
|
|
|
|
}else if(strcasecmp(arg, "blue") == 0) {
|
|
|
|
obj->data.l = COLOR_BLUE;
|
|
|
|
}else if(strcasecmp(arg, "magenta") == 0) {
|
|
|
|
obj->data.l = COLOR_MAGENTA;
|
|
|
|
}else if(strcasecmp(arg, "cyan") == 0) {
|
|
|
|
obj->data.l = COLOR_CYAN;
|
|
|
|
}else if(strcasecmp(arg, "black") == 0) {
|
|
|
|
obj->data.l = COLOR_BLACK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set_current_text_color(obj->data.l);
|
|
|
|
init_pair(obj->data.l, obj->data.l, COLOR_BLACK);
|
|
|
|
}
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_NCURSES */
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color0, 0)
|
|
|
|
obj->data.l = color0;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color1, 0)
|
|
|
|
obj->data.l = color1;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color2, 0)
|
|
|
|
obj->data.l = color2;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color3, 0)
|
|
|
|
obj->data.l = color3;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color4, 0)
|
|
|
|
obj->data.l = color4;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color5, 0)
|
|
|
|
obj->data.l = color5;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color6, 0)
|
|
|
|
obj->data.l = color6;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color7, 0)
|
|
|
|
obj->data.l = color7;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color8, 0)
|
|
|
|
obj->data.l = color8;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(color9, 0)
|
|
|
|
obj->data.l = color9;
|
|
|
|
set_current_text_color(obj->data.l);
|
2009-11-08 15:25:11 +00:00
|
|
|
obj->callbacks.print = &new_fg;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(font, 0)
|
2009-11-08 12:46:42 +00:00
|
|
|
scan_font(obj, arg);
|
2009-11-29 18:43:27 +00:00
|
|
|
obj->callbacks.print = &new_font;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(conky_version, 0)
|
2009-11-29 19:04:55 +00:00
|
|
|
obj_be_plain_text(obj, VERSION);
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(conky_build_date, 0)
|
2009-11-29 19:04:55 +00:00
|
|
|
obj_be_plain_text(obj, BUILD_DATE);
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(conky_build_arch, 0)
|
2009-11-29 19:04:55 +00:00
|
|
|
obj_be_plain_text(obj, BUILD_ARCH);
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(downspeed, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_downspeed;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(downspeedf, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_downspeedf;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(downspeedgraph, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
2009-11-23 23:21:16 +00:00
|
|
|
obj->callbacks.graphval = &downspeedgraphval;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(else, 0)
|
|
|
|
obj_be_ifblock_else(ifblock_opaque, obj);
|
2009-11-28 21:53:20 +00:00
|
|
|
obj->callbacks.iftest = &gen_false_iftest;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(endif, 0)
|
|
|
|
obj_be_ifblock_endif(ifblock_opaque, obj);
|
2009-11-28 22:02:58 +00:00
|
|
|
obj->callbacks.print = &gen_print_nothing;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(eval, 0)
|
|
|
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
2009-11-26 00:15:33 +00:00
|
|
|
obj->callbacks.print = &print_evaluate;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2010-01-07 02:38:12 +00:00
|
|
|
#if defined(BUILD_IMLIB2) && defined(BUILD_X11)
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(image, 0)
|
|
|
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
2009-11-28 21:45:01 +00:00
|
|
|
obj->callbacks.print = &print_image_callback;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_IMLIB2 */
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(exec, 0)
|
2009-10-15 19:51:21 +00:00
|
|
|
scan_exec_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_exec;
|
|
|
|
obj->callbacks.free = &free_exec;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(execp, 0)
|
2009-10-15 19:51:21 +00:00
|
|
|
scan_exec_arg(obj, arg);
|
2009-11-29 19:18:37 +00:00
|
|
|
obj->verbatim_output = 1;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_execp;
|
|
|
|
obj->callbacks.free = &free_exec;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(execbar, 0)
|
2009-10-15 19:51:21 +00:00
|
|
|
scan_exec_arg(obj, arg);
|
2009-11-22 21:06:04 +00:00
|
|
|
obj->callbacks.barval = &execbarval;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_exec;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(execgauge, 0)
|
2009-10-15 19:51:21 +00:00
|
|
|
scan_exec_arg(obj, arg);
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.gaugeval = &execbarval;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_exec;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(execgraph, 0)
|
2009-10-29 02:08:08 +00:00
|
|
|
scan_execgraph_arg(obj, arg);
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.graphval = &execbarval;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_exec;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-10-15 19:51:21 +00:00
|
|
|
END OBJ_ARG(execibar, 0, "execibar needs arguments")
|
2009-12-04 01:09:41 +00:00
|
|
|
scan_execi_bar_arg(obj, arg);
|
2009-11-30 22:59:13 +00:00
|
|
|
obj->callbacks.barval = &execi_barval;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_execi;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-10-15 19:51:21 +00:00
|
|
|
END OBJ_ARG(execigraph, 0, "execigraph needs arguments")
|
2009-10-29 02:08:08 +00:00
|
|
|
scan_execgraph_arg(obj, arg);
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.graphval = &execi_barval;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_execi;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-10-15 19:51:21 +00:00
|
|
|
END OBJ_ARG(execigauge, 0, "execigauge needs arguments")
|
2009-12-04 01:09:41 +00:00
|
|
|
scan_execi_gauge_arg(obj, arg);
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.gaugeval = &execi_barval;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_execi;
|
2009-10-15 19:51:21 +00:00
|
|
|
END OBJ_ARG(execi, 0, "execi needs arguments")
|
|
|
|
scan_execi_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_execi;
|
|
|
|
obj->callbacks.free = &free_execi;
|
2009-10-15 19:51:21 +00:00
|
|
|
END OBJ_ARG(execpi, 0, "execpi needs arguments")
|
|
|
|
scan_execi_arg(obj, arg);
|
2009-11-29 19:18:37 +00:00
|
|
|
obj->verbatim_output = 1;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_execpi;
|
|
|
|
obj->callbacks.free = &free_execi;
|
2009-10-15 19:51:21 +00:00
|
|
|
END OBJ_ARG(texeci, 0, "texeci needs arguments")
|
|
|
|
scan_execi_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_texeci;
|
|
|
|
obj->callbacks.free = &free_execi;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(pre_exec, 0)
|
2009-10-15 19:51:21 +00:00
|
|
|
scan_pre_exec_arg(obj, arg);
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(fs_bar, &update_fs_stats)
|
2009-10-04 13:50:47 +00:00
|
|
|
init_fs_bar(obj, arg);
|
2009-11-23 22:34:21 +00:00
|
|
|
obj->callbacks.barval = &fs_barval;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(fs_bar_free, &update_fs_stats)
|
2009-10-04 13:50:47 +00:00
|
|
|
init_fs_bar(obj, arg);
|
2009-11-23 22:34:21 +00:00
|
|
|
obj->callbacks.barval = &fs_free_barval;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(fs_free, &update_fs_stats)
|
2009-10-04 14:53:21 +00:00
|
|
|
init_fs(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_fs_free;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(fs_used_perc, &update_fs_stats)
|
2009-10-04 14:53:21 +00:00
|
|
|
init_fs(obj, arg);
|
2009-11-25 00:43:36 +00:00
|
|
|
obj->callbacks.percentage = &fs_used_percentage;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(fs_free_perc, &update_fs_stats)
|
2009-10-04 14:53:21 +00:00
|
|
|
init_fs(obj, arg);
|
2009-11-25 00:43:36 +00:00
|
|
|
obj->callbacks.percentage = &fs_free_percentage;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(fs_size, &update_fs_stats)
|
2009-10-04 14:53:21 +00:00
|
|
|
init_fs(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_fs_size;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(fs_type, &update_fs_stats)
|
2009-10-04 14:53:21 +00:00
|
|
|
init_fs(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_fs_type;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(fs_used, &update_fs_stats)
|
2009-10-04 14:53:21 +00:00
|
|
|
init_fs(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_fs_used;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(hr, 0)
|
2009-11-08 13:49:27 +00:00
|
|
|
obj->data.l = arg ? atoi(arg) : 1;
|
2009-11-08 16:08:02 +00:00
|
|
|
obj->callbacks.print = &new_hr;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(nameserver, &update_dns_data)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_nameserver_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_nameserver;
|
2009-11-29 19:55:42 +00:00
|
|
|
obj->callbacks.free = &free_dns_data;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(offset, 0)
|
2009-11-08 13:49:27 +00:00
|
|
|
obj->data.l = arg ? atoi(arg) : 1;
|
2009-11-08 16:02:19 +00:00
|
|
|
obj->callbacks.print = &new_offset;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(voffset, 0)
|
2009-11-08 13:49:27 +00:00
|
|
|
obj->data.l = arg ? atoi(arg) : 1;
|
2009-11-08 16:02:19 +00:00
|
|
|
obj->callbacks.print = &new_voffset;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(goto, 0, "goto needs arguments")
|
2009-11-08 13:49:27 +00:00
|
|
|
obj->data.l = atoi(arg);
|
2009-11-08 15:54:30 +00:00
|
|
|
obj->callbacks.print = &new_goto;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(tab, 0)
|
2009-10-29 02:18:24 +00:00
|
|
|
scan_tab(obj, arg);
|
2009-11-08 15:54:30 +00:00
|
|
|
obj->callbacks.print = &new_tab;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-08-07 07:24:24 +00:00
|
|
|
#ifdef __linux__
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(i2c, 0, "i2c needs arguments")
|
2009-10-04 16:05:47 +00:00
|
|
|
parse_i2c_sensor(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_sysfs_sensor;
|
|
|
|
obj->callbacks.free = &free_sysfs_sensor;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(platform, 0, "platform needs arguments")
|
2009-10-04 16:05:47 +00:00
|
|
|
parse_platform_sensor(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_sysfs_sensor;
|
|
|
|
obj->callbacks.free = &free_sysfs_sensor;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(hwmon, 0, "hwmon needs argumanets")
|
2009-10-04 16:05:47 +00:00
|
|
|
parse_hwmon_sensor(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_sysfs_sensor;
|
|
|
|
obj->callbacks.free = &free_sysfs_sensor;
|
2009-11-18 15:15:37 +00:00
|
|
|
#endif /* __linux__ */
|
2009-08-07 07:24:24 +00:00
|
|
|
END
|
|
|
|
/* we have four different types of top (top, top_mem, top_time and top_io). To
|
|
|
|
* avoid having almost-same code four times, we have this special
|
|
|
|
* handler. */
|
2009-11-16 21:49:31 +00:00
|
|
|
/* XXX: maybe fiddle them apart later, as print_top() does
|
|
|
|
* nothing else than just that, using an ugly switch(). */
|
2009-08-07 07:24:24 +00:00
|
|
|
if (strncmp(s, "top", 3) == EQUAL) {
|
2009-12-12 18:50:36 +00:00
|
|
|
if (parse_top_args(s, arg, obj)) {
|
|
|
|
add_update_callback(&update_top);
|
|
|
|
} else {
|
|
|
|
free(obj);
|
2009-08-07 07:24:24 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2009-11-18 15:15:37 +00:00
|
|
|
} else
|
|
|
|
#ifdef __linux__
|
|
|
|
OBJ(addr, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_addr;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(addrs, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_addrs;
|
2009-11-18 15:15:37 +00:00
|
|
|
END
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif /* __linux__ */
|
2009-11-18 15:15:37 +00:00
|
|
|
OBJ_ARG(tail, 0, "tail needs arguments")
|
2009-08-07 07:24:24 +00:00
|
|
|
init_tailhead("tail", arg, obj, free_at_crash);
|
2009-11-08 16:02:19 +00:00
|
|
|
obj->callbacks.print = &print_tail;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_tailhead;
|
2009-10-04 12:44:20 +00:00
|
|
|
END OBJ_ARG(head, 0, "head needs arguments")
|
2009-08-07 07:24:24 +00:00
|
|
|
init_tailhead("head", arg, obj, free_at_crash);
|
2009-11-08 16:02:19 +00:00
|
|
|
obj->callbacks.print = &print_head;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_tailhead;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(lines, 0, "lines needs an argument")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_lines;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(words, 0, "words needs a argument")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_words;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(loadavg, &update_load_average)
|
2009-10-25 12:49:10 +00:00
|
|
|
scan_loadavg_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_loadavg;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_IF_ARG(if_empty, 0, "if_empty needs an argument")
|
2009-12-10 04:05:32 +00:00
|
|
|
obj->sub = (text_object*)malloc(sizeof(struct text_object));
|
2009-10-27 00:24:52 +00:00
|
|
|
extract_variable_text_internal(obj->sub, arg);
|
2009-11-26 00:30:58 +00:00
|
|
|
obj->callbacks.iftest = &if_empty_iftest;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_IF_ARG(if_match, 0, "if_match needs arguments")
|
2009-12-10 04:05:32 +00:00
|
|
|
obj->sub = (text_object*)malloc(sizeof(struct text_object));
|
2009-10-27 00:24:52 +00:00
|
|
|
extract_variable_text_internal(obj->sub, arg);
|
2009-11-26 00:30:58 +00:00
|
|
|
obj->callbacks.iftest = &check_if_match;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_IF_ARG(if_existing, 0, "if_existing needs an argument or two")
|
2009-10-29 02:52:59 +00:00
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-26 00:30:58 +00:00
|
|
|
obj->callbacks.iftest = &if_existing_iftest;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_IF_ARG(if_mounted, 0, "if_mounted needs an argument")
|
2009-10-29 02:52:59 +00:00
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-16 22:30:53 +00:00
|
|
|
obj->callbacks.iftest = &check_mount;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-08-07 07:24:24 +00:00
|
|
|
#ifdef __linux__
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_IF_ARG(if_running, &update_top, "if_running needs an argument")
|
|
|
|
top_running = 1;
|
2009-10-29 02:52:59 +00:00
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-26 00:30:58 +00:00
|
|
|
obj->callbacks.iftest = &if_running_iftest;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-08-07 07:24:24 +00:00
|
|
|
#else
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_IF_ARG(if_running, 0, "if_running needs an argument")
|
2009-11-24 12:23:58 +00:00
|
|
|
char buf[text_buffer_size];
|
2009-08-07 07:21:56 +00:00
|
|
|
|
2009-11-24 12:23:58 +00:00
|
|
|
snprintf(buf, text_buffer_size, "pidof %s >/dev/null", arg);
|
2009-10-29 02:52:59 +00:00
|
|
|
obj->data.s = strndup(buf, text_buffer_size);
|
2009-11-26 00:30:58 +00:00
|
|
|
/* XXX: maybe use a different callback here */
|
|
|
|
obj->callbacks.iftest = &if_running_iftest;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif
|
|
|
|
END OBJ(kernel, 0)
|
2009-11-25 23:12:44 +00:00
|
|
|
obj->callbacks.print = &print_kernel;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(machine, 0)
|
2009-11-25 23:12:44 +00:00
|
|
|
obj->callbacks.print = &print_machine;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(new_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_new_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(seen_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_seen_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(unseen_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_unseen_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(flagged_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_flagged_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(unflagged_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_unflagged_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(forwarded_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_forwarded_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(unforwarded_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_unforwarded_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(replied_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_replied_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(unreplied_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_unreplied_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(draft_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_draft_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(trashed_mails, 0)
|
2009-10-24 23:13:50 +00:00
|
|
|
parse_local_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_trashed_mails;
|
|
|
|
obj->callbacks.free = &free_local_mails;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(mboxscan, 0)
|
2009-10-06 19:59:45 +00:00
|
|
|
parse_mboxscan_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mboxscan;
|
|
|
|
obj->callbacks.free = &free_mboxscan;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mem, &update_meminfo)
|
2009-11-25 23:09:38 +00:00
|
|
|
obj->callbacks.print = &print_mem;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(memeasyfree, &update_meminfo)
|
2009-11-25 23:09:38 +00:00
|
|
|
obj->callbacks.print = &print_memeasyfree;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(memfree, &update_meminfo)
|
2009-11-25 23:09:38 +00:00
|
|
|
obj->callbacks.print = &print_memfree;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(memmax, &update_meminfo)
|
2009-11-25 23:09:38 +00:00
|
|
|
obj->callbacks.print = &print_memmax;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(memperc, &update_meminfo)
|
2009-11-25 00:33:13 +00:00
|
|
|
obj->callbacks.percentage = &mem_percentage;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(memgauge, &update_meminfo)
|
2009-12-04 00:22:36 +00:00
|
|
|
scan_gauge(obj, arg, 1);
|
2009-11-23 22:15:34 +00:00
|
|
|
obj->callbacks.gaugeval = &mem_barval;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(membar, &update_meminfo)
|
2009-12-04 00:22:36 +00:00
|
|
|
scan_bar(obj, arg, 1);
|
2009-11-23 22:15:34 +00:00
|
|
|
obj->callbacks.barval = &mem_barval;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(memgraph, &update_meminfo)
|
2009-08-07 07:24:24 +00:00
|
|
|
char *buf = 0;
|
2009-12-04 00:22:36 +00:00
|
|
|
buf = scan_graph(obj, arg, 1);
|
2009-08-07 07:24:24 +00:00
|
|
|
|
|
|
|
if (buf) free(buf);
|
2009-11-23 22:15:34 +00:00
|
|
|
obj->callbacks.graphval = &mem_barval;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11*/
|
2009-09-06 23:12:11 +00:00
|
|
|
END OBJ(mixer, 0)
|
2009-10-06 19:48:26 +00:00
|
|
|
parse_mixer_arg(obj, arg);
|
2009-11-25 00:47:53 +00:00
|
|
|
obj->callbacks.percentage = &mixer_percentage;
|
2009-09-06 23:12:11 +00:00
|
|
|
END OBJ(mixerl, 0)
|
2009-10-06 19:48:26 +00:00
|
|
|
parse_mixer_arg(obj, arg);
|
2009-11-25 00:47:53 +00:00
|
|
|
obj->callbacks.percentage = &mixerl_percentage;
|
2009-09-06 23:12:11 +00:00
|
|
|
END OBJ(mixerr, 0)
|
2009-10-06 19:48:26 +00:00
|
|
|
parse_mixer_arg(obj, arg);
|
2009-11-25 00:47:53 +00:00
|
|
|
obj->callbacks.percentage = &mixerr_percentage;
|
2009-09-06 23:12:11 +00:00
|
|
|
END OBJ(mixerbar, 0)
|
2009-10-06 19:48:26 +00:00
|
|
|
scan_mixer_bar(obj, arg);
|
2009-11-23 22:41:44 +00:00
|
|
|
obj->callbacks.barval = &mixer_barval;
|
2009-09-06 23:12:11 +00:00
|
|
|
END OBJ(mixerlbar, 0)
|
2009-10-06 19:48:26 +00:00
|
|
|
scan_mixer_bar(obj, arg);
|
2009-11-23 22:41:44 +00:00
|
|
|
obj->callbacks.barval = &mixerl_barval;
|
2009-09-06 23:12:11 +00:00
|
|
|
END OBJ(mixerrbar, 0)
|
2009-10-06 19:48:26 +00:00
|
|
|
scan_mixer_bar(obj, arg);
|
2009-11-23 22:41:44 +00:00
|
|
|
obj->callbacks.barval = &mixerr_barval;
|
2009-09-06 23:12:11 +00:00
|
|
|
END OBJ_IF(if_mixer_mute, 0)
|
2009-10-06 19:48:26 +00:00
|
|
|
parse_mixer_arg(obj, arg);
|
2009-11-16 22:32:35 +00:00
|
|
|
obj->callbacks.iftest = &check_mixer_muted;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-11-25 23:02:57 +00:00
|
|
|
END OBJ(monitor, 0)
|
2009-11-25 22:56:19 +00:00
|
|
|
obj->callbacks.print = &print_monitor;
|
2009-11-25 23:02:57 +00:00
|
|
|
END OBJ(monitor_number, 0)
|
2009-11-25 22:56:19 +00:00
|
|
|
obj->callbacks.print = &print_monitor_number;
|
2009-11-25 23:02:57 +00:00
|
|
|
END OBJ(desktop, 0)
|
2009-11-25 22:56:19 +00:00
|
|
|
obj->callbacks.print = &print_desktop;
|
2009-11-25 23:02:57 +00:00
|
|
|
END OBJ(desktop_number, 0)
|
2009-11-25 22:56:19 +00:00
|
|
|
obj->callbacks.print = &print_desktop_number;
|
2009-11-25 23:02:57 +00:00
|
|
|
END OBJ(desktop_name, 0)
|
2009-11-25 22:56:19 +00:00
|
|
|
obj->callbacks.print = &print_desktop_name;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-11-18 14:35:35 +00:00
|
|
|
END OBJ_ARG(format_time, 0, "format_time needs a pid as argument")
|
2009-12-10 04:05:32 +00:00
|
|
|
obj->sub = (text_object*)malloc(sizeof(struct text_object));
|
2009-11-18 14:35:35 +00:00
|
|
|
extract_variable_text_internal(obj->sub, arg);
|
2009-11-25 23:20:42 +00:00
|
|
|
obj->callbacks.print = &print_format_time;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(nodename, 0)
|
2009-11-25 23:22:25 +00:00
|
|
|
obj->callbacks.print = &print_nodename;
|
2009-11-14 21:07:54 +00:00
|
|
|
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);
|
2009-11-26 00:11:33 +00:00
|
|
|
obj->callbacks.print = &print_cmdline_to_pid;
|
2009-11-29 19:47:00 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-11-13 15:54:40 +00:00
|
|
|
END OBJ_ARG(pid_chroot, 0, "pid_chroot needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_chroot;
|
2009-11-11 15:27:19 +00:00
|
|
|
END OBJ_ARG(pid_cmdline, 0, "pid_cmdline needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_cmdline;
|
2009-11-11 15:27:19 +00:00
|
|
|
END OBJ_ARG(pid_cwd, 0, "pid_cwd needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_cwd;
|
2009-11-11 21:56:12 +00:00
|
|
|
END OBJ_ARG(pid_environ, 0, "pid_environ needs arguments")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_environ;
|
2009-11-12 19:34:43 +00:00
|
|
|
END OBJ_ARG(pid_environ_list, 0, "pid_environ_list needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_environ_list;
|
2009-11-12 19:34:43 +00:00
|
|
|
END OBJ_ARG(pid_exe, 0, "pid_exe needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_exe;
|
2009-11-16 14:01:43 +00:00
|
|
|
END OBJ_ARG(pid_nice, 0, "pid_nice needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_nice;
|
2009-11-12 23:36:46 +00:00
|
|
|
END OBJ_ARG(pid_openfiles, 0, "pid_openfiles needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_openfiles;
|
2009-11-15 12:26:40 +00:00
|
|
|
END OBJ_ARG(pid_parent, 0, "pid_parent needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_parent;
|
2009-11-16 14:01:43 +00:00
|
|
|
END OBJ_ARG(pid_priority, 0, "pid_priority needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_priority;
|
2009-11-14 12:58:07 +00:00
|
|
|
END OBJ_ARG(pid_state, 0, "pid_state needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_state;
|
2009-11-14 21:07:54 +00:00
|
|
|
END OBJ_ARG(pid_state_short, 0, "pid_state_short needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_state_short;
|
2009-11-12 19:34:43 +00:00
|
|
|
END OBJ_ARG(pid_stderr, 0, "pid_stderr needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_stderr;
|
2009-11-12 19:34:43 +00:00
|
|
|
END OBJ_ARG(pid_stdin, 0, "pid_stdin needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_stdin;
|
2009-11-12 19:34:43 +00:00
|
|
|
END OBJ_ARG(pid_stdout, 0, "pid_stdout needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_stdout;
|
2009-11-16 08:54:17 +00:00
|
|
|
END OBJ_ARG(pid_threads, 0, "pid_threads needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_threads;
|
2009-11-16 08:54:17 +00:00
|
|
|
END OBJ_ARG(pid_thread_list, 0, "pid_thread_list needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_thread_list;
|
2009-11-16 14:30:57 +00:00
|
|
|
END OBJ_ARG(pid_time_kernelmode, 0, "pid_time_kernelmode needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_time_kernelmode;
|
2009-11-16 14:30:57 +00:00
|
|
|
END OBJ_ARG(pid_time_usermode, 0, "pid_time_usermode needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_time_usermode;
|
2009-11-16 14:30:57 +00:00
|
|
|
END OBJ_ARG(pid_time, 0, "pid_time needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_time;
|
2009-11-15 13:49:55 +00:00
|
|
|
END OBJ_ARG(pid_uid, 0, "pid_uid needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_uid;
|
2009-11-15 13:49:55 +00:00
|
|
|
END OBJ_ARG(pid_euid, 0, "pid_euid needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_euid;
|
2009-11-15 13:49:55 +00:00
|
|
|
END OBJ_ARG(pid_suid, 0, "pid_suid needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_suid;
|
2009-11-15 13:49:55 +00:00
|
|
|
END OBJ_ARG(pid_fsuid, 0, "pid_fsuid needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_fsuid;
|
2009-11-15 13:49:55 +00:00
|
|
|
END OBJ_ARG(pid_gid, 0, "pid_gid needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_gid;
|
2009-11-15 13:49:55 +00:00
|
|
|
END OBJ_ARG(pid_egid, 0, "pid_egid needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_egid;
|
2009-11-15 13:49:55 +00:00
|
|
|
END OBJ_ARG(pid_sgid, 0, "pid_sgid needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_sgid;
|
2009-11-15 13:49:55 +00:00
|
|
|
END OBJ_ARG(pid_fsgid, 0, "pid_fsgid needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_fsgid;
|
2009-11-15 16:46:41 +00:00
|
|
|
END OBJ_ARG(gid_name, 0, "gid_name needs a gid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:40:23 +00:00
|
|
|
obj->callbacks.print = &print_gid_name;
|
2009-11-15 16:21:55 +00:00
|
|
|
END OBJ_ARG(uid_name, 0, "uid_name needs a uid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:40:23 +00:00
|
|
|
obj->callbacks.print = &print_uid_name;
|
2009-11-19 11:32:14 +00:00
|
|
|
END OBJ_ARG(pid_read, 0, "pid_read needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_read;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmpeak, 0, "pid_vmpeak needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmpeak;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmsize, 0, "pid_vmsize needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmsize;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmlck, 0, "pid_vmlck needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmlck;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmhwm, 0, "pid_vmhwm needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmhwm;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmrss, 0, "pid_vmrss needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmrss;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmdata, 0, "pid_vmdata needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmdata;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmstk, 0, "pid_vmstk needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmstk;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmexe, 0, "pid_vmexe needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmexe;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmlib, 0, "pid_vmlib needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmlib;
|
2009-11-15 18:44:37 +00:00
|
|
|
END OBJ_ARG(pid_vmpte, 0, "pid_vmpte needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_vmpte;
|
2009-11-19 11:32:14 +00:00
|
|
|
END OBJ_ARG(pid_write, 0, "pid_write needs a pid as argument")
|
2009-11-29 15:27:12 +00:00
|
|
|
extract_object_args_to_sub(obj, arg);
|
2009-11-29 15:34:15 +00:00
|
|
|
obj->callbacks.print = &print_pid_write;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(processes, &update_total_processes)
|
2009-11-26 00:06:53 +00:00
|
|
|
obj->callbacks.print = &print_processes;
|
2009-11-14 03:19:51 +00:00
|
|
|
#ifdef __linux__
|
2009-11-15 16:42:59 +00:00
|
|
|
END OBJ(running_processes, &update_top)
|
2009-11-15 22:00:14 +00:00
|
|
|
top_running = 1;
|
2009-11-26 00:06:53 +00:00
|
|
|
obj->callbacks.print = &print_running_processes;
|
2009-11-07 17:14:04 +00:00
|
|
|
END OBJ(threads, &update_threads)
|
2009-11-26 00:06:53 +00:00
|
|
|
obj->callbacks.print = &print_threads;
|
2009-11-15 16:42:59 +00:00
|
|
|
END OBJ(running_threads, &update_stat)
|
2009-11-26 00:06:53 +00:00
|
|
|
obj->callbacks.print = &print_running_threads;
|
2009-11-15 16:42:59 +00:00
|
|
|
#else
|
|
|
|
END OBJ(running_processes, &update_running_processes)
|
2009-11-26 00:06:53 +00:00
|
|
|
obj->callbacks.print = &print_running_processes;
|
2009-11-15 16:42:59 +00:00
|
|
|
#endif /* __linux__ */
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(shadecolor, 0)
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
obj->data.l = arg ? get_x11_color(arg) : default_bg_color;
|
2009-11-08 15:28:02 +00:00
|
|
|
obj->callbacks.print = &new_bg;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(outlinecolor, 0)
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-08-07 07:24:24 +00:00
|
|
|
obj->data.l = arg ? get_x11_color(arg) : default_out_color;
|
2009-11-08 15:26:02 +00:00
|
|
|
obj->callbacks.print = &new_outline;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(stippled_hr, 0)
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-10-29 02:22:58 +00:00
|
|
|
scan_stippled_hr(obj, arg);
|
2009-11-08 16:08:02 +00:00
|
|
|
obj->callbacks.print = &new_stippled_hr;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(swap, &update_meminfo)
|
2009-11-25 23:09:38 +00:00
|
|
|
obj->callbacks.print = &print_swap;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(swapfree, &update_meminfo)
|
2009-11-25 23:09:38 +00:00
|
|
|
obj->callbacks.print = &print_swapfree;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(swapmax, &update_meminfo)
|
2009-11-25 23:09:38 +00:00
|
|
|
obj->callbacks.print = &print_swapmax;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(swapperc, &update_meminfo)
|
2009-11-25 00:34:54 +00:00
|
|
|
obj->callbacks.percentage = &swap_percentage;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(swapbar, &update_meminfo)
|
2009-12-04 00:25:41 +00:00
|
|
|
scan_bar(obj, arg, 1);
|
2009-11-30 22:55:48 +00:00
|
|
|
obj->callbacks.barval = &swap_barval;
|
|
|
|
/* XXX: swapgraph, swapgauge? */
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(sysname, 0)
|
2009-11-25 23:29:50 +00:00
|
|
|
obj->callbacks.print = &print_sysname;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(time, 0)
|
2009-10-03 15:46:59 +00:00
|
|
|
scan_time(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_time;
|
|
|
|
obj->callbacks.free = &free_time;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(utime, 0)
|
2009-10-03 15:46:59 +00:00
|
|
|
scan_time(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_utime;
|
|
|
|
obj->callbacks.free = &free_time;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(tztime, 0)
|
2009-10-03 15:46:59 +00:00
|
|
|
scan_tztime(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_tztime;
|
|
|
|
obj->callbacks.free = &free_tztime;
|
2009-08-07 07:24:24 +00:00
|
|
|
#ifdef HAVE_ICONV
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(iconv_start, 0, "Iconv requires arguments")
|
2009-10-03 18:01:33 +00:00
|
|
|
init_iconv_start(obj, free_at_crash, arg);
|
2009-11-29 13:24:14 +00:00
|
|
|
obj->callbacks.print = &print_iconv_start;
|
|
|
|
obj->callbacks.free = &free_iconv;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(iconv_stop, 0)
|
2009-10-03 18:01:33 +00:00
|
|
|
init_iconv_stop();
|
2009-11-29 13:24:14 +00:00
|
|
|
obj->callbacks.print = &print_iconv_stop;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(totaldown, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_totaldown;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(totalup, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_totalup;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(updates, 0)
|
2009-11-29 18:48:24 +00:00
|
|
|
obj->callbacks.print = &print_updates;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ_IF(if_updatenr, 0)
|
2009-10-29 02:52:59 +00:00
|
|
|
obj->data.i = arg ? atoi(arg) : 0;
|
|
|
|
if(obj->data.i == 0) CRIT_ERR(obj, free_at_crash, "if_updatenr needs a number above 0 as argument");
|
|
|
|
set_updatereset(obj->data.i > get_updatereset() ? obj->data.i : get_updatereset());
|
2009-11-29 18:50:59 +00:00
|
|
|
obj->callbacks.iftest = &updatenr_iftest;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(alignr, 0)
|
2009-11-08 13:49:27 +00:00
|
|
|
obj->data.l = arg ? atoi(arg) : 1;
|
2009-11-08 16:02:19 +00:00
|
|
|
obj->callbacks.print = &new_alignr;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(alignc, 0)
|
2009-11-08 13:49:27 +00:00
|
|
|
obj->data.l = arg ? atoi(arg) : 0;
|
2009-11-08 16:02:19 +00:00
|
|
|
obj->callbacks.print = &new_alignc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(upspeed, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_upspeed;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(upspeedf, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_upspeedf;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(upspeedgraph, &update_net_stats)
|
2009-10-17 14:43:12 +00:00
|
|
|
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
2009-11-23 23:21:16 +00:00
|
|
|
obj->callbacks.graphval = &upspeedgraphval;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(uptime_short, &update_uptime)
|
2009-11-25 23:34:01 +00:00
|
|
|
obj->callbacks.print = &print_uptime_short;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(uptime, &update_uptime)
|
2009-11-25 23:34:01 +00:00
|
|
|
obj->callbacks.print = &print_uptime;
|
2009-11-14 03:19:51 +00:00
|
|
|
#if defined(__linux__)
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(user_names, &update_users)
|
2009-11-25 23:51:19 +00:00
|
|
|
obj->callbacks.print = &print_user_names;
|
|
|
|
obj->callbacks.free = &free_user_names;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(user_times, &update_users)
|
2009-11-25 23:51:19 +00:00
|
|
|
obj->callbacks.print = &print_user_times;
|
|
|
|
obj->callbacks.free = &free_user_times;
|
2009-11-14 14:57:45 +00:00
|
|
|
END OBJ_ARG(user_time, 0, "user time needs a console name as argument")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-25 23:51:19 +00:00
|
|
|
obj->callbacks.print = &print_user_time;
|
|
|
|
obj->callbacks.free = &free_user_time;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(user_terms, &update_users)
|
2009-11-25 23:51:19 +00:00
|
|
|
obj->callbacks.print = &print_user_terms;
|
|
|
|
obj->callbacks.free = &free_user_terms;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(user_number, &update_users)
|
2009-11-25 23:51:19 +00:00
|
|
|
obj->callbacks.print = &print_user_number;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(gw_iface, &update_gateway_info)
|
2009-11-16 00:09:37 +00:00
|
|
|
obj->callbacks.print = &print_gateway_iface;
|
2009-11-29 19:52:36 +00:00
|
|
|
obj->callbacks.free = &free_gateway_info;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(gw_ip, &update_gateway_info)
|
2009-11-16 00:09:37 +00:00
|
|
|
obj->callbacks.print = &print_gateway_ip;
|
2009-11-29 19:52:36 +00:00
|
|
|
obj->callbacks.free = &free_gateway_info;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif /* !__linux__ */
|
|
|
|
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
|
|
|
|
|| defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
|
|
|
|
END OBJ(apm_adapter, 0)
|
2009-11-29 13:14:06 +00:00
|
|
|
obj->callbacks.print = &print_apm_adapter;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(apm_battery_life, 0)
|
2009-11-29 13:14:06 +00:00
|
|
|
obj->callbacks.print = &print_apm_battery_life;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(apm_battery_time, 0)
|
2009-11-29 13:14:06 +00:00
|
|
|
obj->callbacks.print = &print_apm_battery_time;
|
2009-08-07 07:24:24 +00:00
|
|
|
#endif /* __FreeBSD__ */
|
|
|
|
END OBJ(imap_unseen, 0)
|
2009-10-24 23:17:30 +00:00
|
|
|
parse_imap_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_imap_unseen;
|
|
|
|
obj->callbacks.free = &free_mail_obj;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(imap_messages, 0)
|
2009-10-24 23:17:30 +00:00
|
|
|
parse_imap_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_imap_messages;
|
|
|
|
obj->callbacks.free = &free_mail_obj;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(pop3_unseen, 0)
|
2009-10-24 23:17:30 +00:00
|
|
|
parse_pop3_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_pop3_unseen;
|
|
|
|
obj->callbacks.free = &free_mail_obj;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(pop3_used, 0)
|
2009-10-24 23:17:30 +00:00
|
|
|
parse_pop3_mail_args(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_pop3_used;
|
|
|
|
obj->callbacks.free = &free_mail_obj;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_IBM
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(smapi, 0, "smapi needs an argument")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_smapi;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_IF_ARG(if_smapi_bat_installed, 0, "if_smapi_bat_installed needs an argument")
|
2009-10-29 02:52:59 +00:00
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-25 01:06:14 +00:00
|
|
|
obj->callbacks.iftest = &smapi_bat_installed;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(smapi_bat_perc, 0, "smapi_bat_perc needs an argument")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-25 00:59:58 +00:00
|
|
|
obj->callbacks.percentage = &smapi_bat_percentage;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(smapi_bat_temp, 0, "smapi_bat_temp needs an argument")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_smapi_bat_temp;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(smapi_bat_power, 0, "smapi_bat_power needs an argument")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_smapi_bat_power;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(smapi_bat_bar, 0, "smapi_bat_bar needs an argument")
|
|
|
|
int cnt;
|
|
|
|
if(sscanf(arg, "%i %n", &obj->data.i, &cnt) <= 0) {
|
|
|
|
NORM_ERR("first argument to smapi_bat_bar must be an integer value");
|
|
|
|
obj->data.i = -1;
|
2009-10-25 20:47:47 +00:00
|
|
|
} else
|
2009-12-04 00:27:58 +00:00
|
|
|
arg = scan_bar(obj, arg + cnt, 100);
|
2009-11-23 22:48:12 +00:00
|
|
|
obj->callbacks.barval = &smapi_bat_barval;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_IBM */
|
|
|
|
#ifdef BUILD_MPD
|
2009-08-07 07:24:24 +00:00
|
|
|
#define mpd_set_maxlen(name) \
|
|
|
|
if (arg) { \
|
|
|
|
int i; \
|
|
|
|
sscanf(arg, "%d", &i); \
|
|
|
|
if (i > 0) \
|
|
|
|
obj->data.i = i + 1; \
|
|
|
|
else \
|
|
|
|
NORM_ERR(#name ": invalid length argument"); \
|
|
|
|
}
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mpd_artist, &update_mpd)
|
2009-08-07 07:24:24 +00:00
|
|
|
mpd_set_maxlen(mpd_artist);
|
|
|
|
init_mpd();
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mpd_artist;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mpd_title, &update_mpd)
|
2009-08-07 07:24:24 +00:00
|
|
|
mpd_set_maxlen(mpd_title);
|
|
|
|
init_mpd();
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mpd_title;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-11-08 02:12:22 +00:00
|
|
|
END OBJ(mpd_random, &update_mpd)
|
|
|
|
init_mpd();
|
|
|
|
obj->callbacks.print = &print_mpd_random;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-11-08 02:12:22 +00:00
|
|
|
END OBJ(mpd_repeat, &update_mpd)
|
|
|
|
init_mpd();
|
|
|
|
obj->callbacks.print = &print_mpd_repeat;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-11-08 02:12:22 +00:00
|
|
|
END OBJ(mpd_elapsed, &update_mpd)
|
|
|
|
init_mpd();
|
|
|
|
obj->callbacks.print = &print_mpd_elapsed;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-11-08 02:12:22 +00:00
|
|
|
END OBJ(mpd_length, &update_mpd)
|
|
|
|
init_mpd();
|
|
|
|
obj->callbacks.print = &print_mpd_length;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mpd_track, &update_mpd)
|
2009-08-07 07:24:24 +00:00
|
|
|
mpd_set_maxlen(mpd_track);
|
|
|
|
init_mpd();
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mpd_track;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mpd_name, &update_mpd)
|
2009-08-07 07:24:24 +00:00
|
|
|
mpd_set_maxlen(mpd_name);
|
|
|
|
init_mpd();
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mpd_name;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mpd_file, &update_mpd)
|
2009-08-07 07:24:24 +00:00
|
|
|
mpd_set_maxlen(mpd_file);
|
|
|
|
init_mpd();
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mpd_file;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-11-08 02:12:22 +00:00
|
|
|
END OBJ(mpd_percent, &update_mpd)
|
|
|
|
init_mpd();
|
2009-11-25 00:57:28 +00:00
|
|
|
obj->callbacks.percentage = &mpd_percentage;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mpd_album, &update_mpd)
|
2009-08-07 07:24:24 +00:00
|
|
|
mpd_set_maxlen(mpd_album);
|
|
|
|
init_mpd();
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mpd_album;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-11-08 02:12:22 +00:00
|
|
|
END OBJ(mpd_vol, &update_mpd)
|
|
|
|
init_mpd();
|
|
|
|
obj->callbacks.print = &print_mpd_vol;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-11-08 02:12:22 +00:00
|
|
|
END OBJ(mpd_bitrate, &update_mpd)
|
|
|
|
init_mpd();
|
|
|
|
obj->callbacks.print = &print_mpd_bitrate;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-11-08 02:12:22 +00:00
|
|
|
END OBJ(mpd_status, &update_mpd)
|
|
|
|
init_mpd();
|
|
|
|
obj->callbacks.print = &print_mpd_status;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mpd_bar, &update_mpd)
|
2009-12-04 00:29:56 +00:00
|
|
|
scan_bar(obj, arg, 1);
|
2009-08-07 07:24:24 +00:00
|
|
|
init_mpd();
|
2009-11-23 22:45:08 +00:00
|
|
|
obj->callbacks.barval = &mpd_barval;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(mpd_smart, &update_mpd)
|
2009-08-07 07:24:24 +00:00
|
|
|
mpd_set_maxlen(mpd_smart);
|
|
|
|
init_mpd();
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_mpd_smart;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ_IF(if_mpd_playing, &update_mpd)
|
2009-08-07 07:24:24 +00:00
|
|
|
init_mpd();
|
2009-11-16 22:37:01 +00:00
|
|
|
obj->callbacks.iftest = &check_mpd_playing;
|
2009-11-29 19:58:37 +00:00
|
|
|
obj->callbacks.free = &free_mpd;
|
2009-08-07 07:24:24 +00:00
|
|
|
#undef mpd_set_maxlen
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_MPD */
|
|
|
|
#ifdef BUILD_MOC
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_state, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_state;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_file, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_file;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_title, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_title;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_artist, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_artist;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_song, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_song;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_album, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_album;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_totaltime, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_totaltime;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_timeleft, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_timeleft;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_curtime, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_curtime;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_bitrate, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_bitrate;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(moc_rate, &update_moc)
|
2009-11-08 18:44:03 +00:00
|
|
|
obj->callbacks.print = &print_moc_rate;
|
|
|
|
obj->callbacks.free = &free_moc;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_MOC */
|
|
|
|
#ifdef BUILD_XMMS2
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_artist, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_artist;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_album, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_album;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_title, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_title;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_genre, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_genre;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_comment, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_comment;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_url, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_url;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_tracknr, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_tracknr;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_bitrate, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_bitrate;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_date, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_date;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_id, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_id;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_duration, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_duration;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_elapsed, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_elapsed;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_size, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_size;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_status, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_status;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_percent, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_percent;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_bar, &update_xmms2)
|
2009-12-04 00:31:21 +00:00
|
|
|
scan_bar(obj, arg, 1);
|
2009-11-23 22:50:15 +00:00
|
|
|
obj->callbacks.barval = &xmms2_barval;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_smart, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_smart;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_playlist, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_playlist;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(xmms2_timesplayed, &update_xmms2)
|
2009-11-09 22:38:12 +00:00
|
|
|
obj->callbacks.print = &print_xmms2_timesplayed;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ_IF(if_xmms2_connected, &update_xmms2)
|
2009-11-16 22:47:44 +00:00
|
|
|
obj->callbacks.iftest = &if_xmms2_connected;
|
2009-11-29 20:06:59 +00:00
|
|
|
obj->callbacks.free = &free_xmms2;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_XMMS2 */
|
|
|
|
#ifdef BUILD_AUDACIOUS
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_status, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_status;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(audacious_title, &update_audacious, "audacious_title needs an argument")
|
|
|
|
sscanf(arg, "%d", &info.audacious.max_title_len);
|
|
|
|
if (info.audacious.max_title_len > 0) {
|
|
|
|
info.audacious.max_title_len++;
|
|
|
|
} else {
|
|
|
|
CRIT_ERR(obj, free_at_crash, "audacious_title: invalid length argument");
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_title;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_length, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_length;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_length_seconds, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_length_seconds;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_position, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_position;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_position_seconds, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_position_seconds;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_bitrate, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_bitrate;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_frequency, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_frequency;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_channels, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_channels;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_filename, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_filename;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_playlist_length, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_playlist_length;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_playlist_position, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_playlist_position;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_main_volume, &update_audacious)
|
2009-11-08 18:19:42 +00:00
|
|
|
obj->callbacks.print = &print_audacious_main_volume;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(audacious_bar, &update_audacious)
|
2009-12-04 00:32:49 +00:00
|
|
|
scan_bar(obj, arg, 1);
|
2009-11-23 22:22:50 +00:00
|
|
|
obj->callbacks.barval = &audacious_barval;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_AUDACIOUS */
|
|
|
|
#ifdef BUIL_BMPX
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(bmpx_title, &update_bmpx)
|
2009-11-08 18:27:01 +00:00
|
|
|
obj->callbacks.print = &print_bmpx_title;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(bmpx_artist, &update_bmpx)
|
2009-11-08 18:27:01 +00:00
|
|
|
obj->callbacks.print = &print_bmpx_artist;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(bmpx_album, &update_bmpx)
|
2009-11-08 18:27:01 +00:00
|
|
|
obj->callbacks.print = &print_bmpx_album;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(bmpx_track, &update_bmpx)
|
2009-11-08 18:27:01 +00:00
|
|
|
obj->callbacks.print = &print_bmpx_track;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(bmpx_uri, &update_bmpx)
|
2009-11-08 18:27:01 +00:00
|
|
|
obj->callbacks.print = &print_bmpx_uri;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(bmpx_bitrate, &update_bmpx)
|
2009-11-08 18:27:01 +00:00
|
|
|
obj->callbacks.print = &print_bmpx_bitrate;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_BMPX */
|
|
|
|
#ifdef BUILD_EVE
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(eve, 0, "eve needs arguments: <userid> <apikey> <characterid>")
|
2009-10-04 16:39:28 +00:00
|
|
|
scan_eve(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_eve;
|
|
|
|
obj->callbacks.free = &free_eve;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_EVE */
|
|
|
|
#ifdef BUILD_CURL
|
2009-09-15 21:54:31 +00:00
|
|
|
END OBJ_ARG(curl, 0, "curl needs arguments: <uri> <interval in minutes>")
|
2009-10-04 19:06:52 +00:00
|
|
|
curl_parse_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &curl_print;
|
|
|
|
obj->callbacks.free = &curl_obj_free;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_CURL */
|
|
|
|
#ifdef BUILD_RSS
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(rss, 0, "rss needs arguments: <uri> <interval in minutes> <action> [act_par] [spaces in front]")
|
2009-10-04 17:04:08 +00:00
|
|
|
rss_scan_arg(obj, arg);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &rss_print_info;
|
|
|
|
obj->callbacks.free = &rss_free_obj_info;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_RSS */
|
|
|
|
#ifdef BUILD_WEATHER_METAR
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(weather, 0, "weather needs arguments: <uri> <locID> <data_type> [interval in minutes]")
|
2009-10-04 17:42:01 +00:00
|
|
|
scan_weather_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_weather;
|
|
|
|
obj->callbacks.free = &free_weather;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_WEATHER_METAR */
|
|
|
|
#ifdef BUILD_WEATHER_XOAP
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(weather_forecast, 0, "weather_forecast needs arguments: <uri> <locID> <day> <data_type> [interval in minutes]")
|
2009-10-04 17:42:01 +00:00
|
|
|
scan_weather_forecast_arg(obj, arg, free_at_crash);
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_weather_forecast;
|
|
|
|
obj->callbacks.free = &free_weather;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_WEATHER_XOAP */
|
|
|
|
#ifdef BUILD_LUA
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(lua, 0, "lua needs arguments: <function name> [function parameters]")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-29 19:18:37 +00:00
|
|
|
obj->verbatim_output = 1;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_lua;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(lua_parse, 0, "lua_parse needs arguments: <function name> [function parameters]")
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-29 19:18:37 +00:00
|
|
|
obj->verbatim_output = 1;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_lua_parse;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(lua_bar, 0, "lua_bar needs arguments: <height>,<width> <function name> [function parameters]")
|
2009-12-04 00:34:11 +00:00
|
|
|
arg = scan_bar(obj, arg, 100);
|
2009-09-09 23:35:57 +00:00
|
|
|
if(arg) {
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-08-07 07:24:24 +00:00
|
|
|
} else {
|
|
|
|
CRIT_ERR(obj, free_at_crash, "lua_bar needs arguments: <height>,<width> <function name> [function parameters]");
|
|
|
|
}
|
2009-11-23 22:36:57 +00:00
|
|
|
obj->callbacks.barval = &lua_barval;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(lua_graph, 0, "lua_graph needs arguments: <function name> [height],[width] [gradient colour 1] [gradient colour 2] [scale] [-t] [-l]")
|
|
|
|
char *buf = 0;
|
2009-12-04 00:34:11 +00:00
|
|
|
buf = scan_graph(obj, arg, 100);
|
2009-09-09 23:35:57 +00:00
|
|
|
if (buf) {
|
|
|
|
obj->data.s = buf;
|
2009-08-07 07:24:24 +00:00
|
|
|
} else {
|
|
|
|
CRIT_ERR(obj, free_at_crash, "lua_graph needs arguments: <function name> [height],[width] [gradient colour 1] [gradient colour 2] [scale] [-t] [-l]");
|
2009-09-09 23:35:57 +00:00
|
|
|
}
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.graphval = &lua_barval;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(lua_gauge, 0, "lua_gauge needs arguments: <height>,<width> <function name> [function parameters]")
|
2009-12-04 00:34:11 +00:00
|
|
|
arg = scan_gauge(obj, arg, 100);
|
2009-08-07 07:24:24 +00:00
|
|
|
if (arg) {
|
2009-09-09 23:35:57 +00:00
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-08-07 07:24:24 +00:00
|
|
|
} else {
|
|
|
|
CRIT_ERR(obj, free_at_crash, "lua_gauge needs arguments: <height>,<width> <function name> [function parameters]");
|
|
|
|
}
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.gaugeval = &lua_barval;
|
2009-11-20 00:44:28 +00:00
|
|
|
obj->callbacks.free = &gen_free_opaque;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_LUA */
|
|
|
|
#ifdef BUILD_HDDTEMP
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(hddtemp, &update_hddtemp)
|
2009-09-06 19:53:53 +00:00
|
|
|
if (arg)
|
|
|
|
obj->data.s = strndup(arg, text_buffer_size);
|
2009-11-08 16:12:37 +00:00
|
|
|
obj->callbacks.print = &print_hddtemp;
|
2009-11-08 03:18:19 +00:00
|
|
|
obj->callbacks.free = &free_hddtemp;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_HDDTEMP */
|
|
|
|
#ifdef BUILD_PORT_MONITORS
|
2009-10-04 15:08:08 +00:00
|
|
|
END OBJ_ARG(tcp_portmon, &tcp_portmon_update, "tcp_portmon: needs arguments")
|
2009-10-04 15:22:25 +00:00
|
|
|
tcp_portmon_init(obj, arg);
|
2009-11-08 15:41:42 +00:00
|
|
|
obj->callbacks.print = &tcp_portmon_action;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &tcp_portmon_free;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_PORT_MONITORS */
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(entropy_avail, &update_entropy)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_entropy_avail;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(entropy_perc, &update_entropy)
|
2009-11-25 00:38:56 +00:00
|
|
|
obj->callbacks.percentage = &entropy_percentage;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(entropy_poolsize, &update_entropy)
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.print = &print_entropy_poolsize;
|
2009-09-06 23:22:16 +00:00
|
|
|
END OBJ(entropy_bar, &update_entropy)
|
2009-12-04 00:35:23 +00:00
|
|
|
scan_bar(obj, arg, 1);
|
2009-11-23 22:26:11 +00:00
|
|
|
obj->callbacks.barval = &entropy_barval;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(include, 0, "include needs a argument")
|
|
|
|
struct conftree *leaf = conftree_add(currentconffile, arg);
|
|
|
|
if(leaf) {
|
|
|
|
if (load_config_file(arg) == TRUE) {
|
2009-12-10 04:05:32 +00:00
|
|
|
obj->sub = (text_object*)malloc(sizeof(struct text_object));
|
2009-09-09 23:35:57 +00:00
|
|
|
currentconffile = leaf;
|
|
|
|
extract_variable_text_internal(obj->sub, get_global_text());
|
|
|
|
currentconffile = leaf->back;
|
2009-11-29 11:59:04 +00:00
|
|
|
obj->callbacks.print = &print_include;
|
2009-08-07 07:24:24 +00:00
|
|
|
} else {
|
2009-09-09 23:35:57 +00:00
|
|
|
NORM_ERR("Can't load configfile '%s'.", arg);
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
|
|
|
} else {
|
2009-09-09 23:35:57 +00:00
|
|
|
NORM_ERR("You are trying to load '%s' recursively, I'm only going to load it once to prevent an infinite loop.", arg);
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(blink, 0, "blink needs a argument")
|
2009-12-10 04:05:32 +00:00
|
|
|
obj->sub = (text_object*)malloc(sizeof(struct text_object));
|
2009-09-09 23:35:57 +00:00
|
|
|
extract_variable_text_internal(obj->sub, arg);
|
2009-11-29 11:56:09 +00:00
|
|
|
obj->callbacks.print = &print_blink;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(to_bytes, 0, "to_bytes needs a argument")
|
2009-12-10 04:05:32 +00:00
|
|
|
obj->sub = (text_object*)malloc(sizeof(struct text_object));
|
2009-09-09 23:35:57 +00:00
|
|
|
extract_variable_text_internal(obj->sub, arg);
|
2009-11-29 11:47:11 +00:00
|
|
|
obj->callbacks.print = &print_to_bytes;
|
2009-08-07 07:24:24 +00:00
|
|
|
END OBJ(scroll, 0)
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-11-08 13:49:27 +00:00
|
|
|
/* allocate a follower to reset any color changes */
|
|
|
|
obj->next = new_text_object_internal();
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-10-06 23:04:32 +00:00
|
|
|
parse_scroll_arg(obj, arg, free_at_crash);
|
2009-11-08 18:50:27 +00:00
|
|
|
obj->callbacks.print = &print_scroll;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_scroll;
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(combine, 0, "combine needs arguments: <text1> <text2>")
|
2009-10-17 14:14:25 +00:00
|
|
|
parse_combine_arg(obj, arg, free_at_crash);
|
2009-11-08 18:53:34 +00:00
|
|
|
obj->callbacks.print = &print_combine;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_combine;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_NVIDIA
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(nvidia, 0, "nvidia needs an argument")
|
2009-10-03 14:14:23 +00:00
|
|
|
if (set_nvidia_type(obj, arg)) {
|
2009-08-07 07:24:24 +00:00
|
|
|
CRIT_ERR(obj, free_at_crash, "nvidia: invalid argument"
|
|
|
|
" specified: '%s'\n", arg);
|
|
|
|
}
|
2009-11-16 21:54:30 +00:00
|
|
|
obj->callbacks.print = &print_nvidia_value;
|
2009-11-08 02:12:22 +00:00
|
|
|
obj->callbacks.free = &free_nvidia;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_NVIDIA */
|
|
|
|
#ifdef BUILD_APCUPSD
|
2009-09-09 23:35:57 +00:00
|
|
|
END OBJ_ARG(apcupsd, &update_apcupsd, "apcupsd needs arguments: <host> <port>")
|
2009-12-17 22:07:15 +00:00
|
|
|
if (apcupsd_scan_arg(arg)) {
|
2009-09-09 23:42:04 +00:00
|
|
|
CRIT_ERR(obj, free_at_crash, "apcupsd needs arguments: <host> <port>");
|
|
|
|
}
|
2009-11-28 22:05:14 +00:00
|
|
|
obj->callbacks.print = &gen_print_nothing;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_name, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_name;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_model, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_model;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_upsmode, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_upsmode;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_cable, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_cable;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_status, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_status;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_linev, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_linev;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_load, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_load;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_loadbar, &update_apcupsd)
|
2009-12-04 00:37:32 +00:00
|
|
|
scan_bar(obj, arg, 100);
|
2009-11-23 22:56:50 +00:00
|
|
|
obj->callbacks.barval = &apcupsd_loadbarval;
|
2010-01-07 02:38:12 +00:00
|
|
|
#ifdef BUILD_X11
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_loadgraph, &update_apcupsd)
|
|
|
|
char* buf = 0;
|
2009-12-04 00:37:32 +00:00
|
|
|
buf = scan_graph(obj, arg, 100);
|
2009-09-09 23:42:04 +00:00
|
|
|
if (buf) free(buf);
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.graphval = &apcupsd_loadbarval;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_X11 */
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_loadgauge, &update_apcupsd)
|
2009-12-04 00:37:32 +00:00
|
|
|
scan_gauge(obj, arg, 100);
|
2009-11-30 23:10:22 +00:00
|
|
|
obj->callbacks.gaugeval = &apcupsd_loadbarval;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_charge, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_charge;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_timeleft, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_timeleft;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_temp, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_temp;
|
2009-09-09 23:42:04 +00:00
|
|
|
END OBJ(apcupsd_lastxfer, &update_apcupsd)
|
2009-11-08 17:14:42 +00:00
|
|
|
obj->callbacks.print = &print_apcupsd_lastxfer;
|
2010-01-07 02:38:12 +00:00
|
|
|
#endif /* BUILD_APCUPSD */
|
2009-08-07 07:24:24 +00:00
|
|
|
END {
|
2009-12-17 21:19:58 +00:00
|
|
|
char *buf = (char *)malloc(text_buffer_size);
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
NORM_ERR("unknown variable %s", s);
|
2009-11-24 12:23:58 +00:00
|
|
|
snprintf(buf, text_buffer_size, "${%s}", s);
|
2009-11-29 19:04:55 +00:00
|
|
|
obj_be_plain_text(obj, buf);
|
2009-12-17 21:19:58 +00:00
|
|
|
free(buf);
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
|
|
|
#undef OBJ
|
2009-09-09 23:35:57 +00:00
|
|
|
#undef OBJ_IF
|
|
|
|
#undef OBJ_ARG
|
|
|
|
#undef OBJ_IF_ARG
|
|
|
|
#undef __OBJ_HEAD
|
|
|
|
#undef __OBJ_IF
|
|
|
|
#undef __OBJ_ARG
|
|
|
|
#undef END
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
return obj;
|
|
|
|
}
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/*
|
|
|
|
* - assumes that *string is '#'
|
|
|
|
* - removes the part from '#' to the end of line ('\n' or '\0')
|
|
|
|
* - it removes the '\n'
|
|
|
|
* - copies the last char into 'char *last' argument, which should be a pointer
|
|
|
|
* to a char rather than a string.
|
|
|
|
*/
|
|
|
|
static size_t remove_comment(char *string, char *last)
|
|
|
|
{
|
|
|
|
char *end = string;
|
|
|
|
while (*end != '\0' && *end != '\n') {
|
|
|
|
++end;
|
|
|
|
}
|
|
|
|
if (last) *last = *end;
|
|
|
|
if (*end == '\n') end++;
|
|
|
|
strfold(string, end - string);
|
|
|
|
return end - string;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t remove_comments(char *string)
|
|
|
|
{
|
|
|
|
char *curplace;
|
|
|
|
size_t folded = 0;
|
|
|
|
for (curplace = string; *curplace != 0; curplace++) {
|
|
|
|
if (*curplace == '\\' && *(curplace + 1) == '#') {
|
|
|
|
// strcpy can't be used for overlapping strings
|
|
|
|
strfold(curplace, 1);
|
|
|
|
folded += 1;
|
|
|
|
} else if (*curplace == '#') {
|
|
|
|
folded += remove_comment(curplace, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return folded;
|
|
|
|
}
|
|
|
|
|
|
|
|
int extract_variable_text_internal(struct text_object *retval, const char *const_p)
|
|
|
|
{
|
|
|
|
struct text_object *obj;
|
|
|
|
char *p, *s, *orig_p;
|
|
|
|
long line;
|
|
|
|
void *ifblock_opaque = NULL;
|
|
|
|
char *tmp_p;
|
|
|
|
char *arg = 0;
|
|
|
|
size_t len = 0;
|
|
|
|
|
|
|
|
p = strndup(const_p, max_user_text - 1);
|
|
|
|
while (text_contains_templates(p)) {
|
|
|
|
char *tmp;
|
|
|
|
tmp = find_and_replace_templates(p);
|
|
|
|
free(p);
|
|
|
|
p = tmp;
|
|
|
|
}
|
|
|
|
s = orig_p = p;
|
|
|
|
|
|
|
|
if (strcmp(p, const_p)) {
|
2010-01-02 19:43:29 +00:00
|
|
|
DBGP2("replaced all templates in text: input is\n'%s'\noutput is\n'%s'", const_p, p);
|
2009-08-07 07:24:24 +00:00
|
|
|
} else {
|
2010-01-02 19:43:29 +00:00
|
|
|
DBGP2("no templates to replace");
|
2009-08-07 07:24:24 +00:00
|
|
|
}
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
memset(retval, 0, sizeof(struct text_object));
|
|
|
|
|
|
|
|
line = global_text_lines;
|
|
|
|
|
|
|
|
while (*p) {
|
|
|
|
if (*p == '\n') {
|
|
|
|
line++;
|
|
|
|
}
|
|
|
|
if (*p == '$') {
|
|
|
|
*p = '\0';
|
|
|
|
obj = create_plain_text(s);
|
|
|
|
if (obj != NULL) {
|
|
|
|
append_object(retval, obj);
|
2009-08-06 06:54:40 +00:00
|
|
|
}
|
2009-08-07 07:24:24 +00:00
|
|
|
*p = '$';
|
|
|
|
p++;
|
|
|
|
s = p;
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
if (*p != '$') {
|
2009-12-17 21:19:58 +00:00
|
|
|
char *buf = (char *)malloc(text_buffer_size);
|
2009-08-07 07:24:24 +00:00
|
|
|
const char *var;
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/* variable is either $foo or ${foo} */
|
|
|
|
if (*p == '{') {
|
|
|
|
unsigned int brl = 1, brr = 0;
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
p++;
|
|
|
|
s = p;
|
|
|
|
while (*p && brl != brr) {
|
|
|
|
if (*p == '{') {
|
|
|
|
brl++;
|
|
|
|
}
|
|
|
|
if (*p == '}') {
|
|
|
|
brr++;
|
|
|
|
}
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
p--;
|
|
|
|
} else {
|
|
|
|
s = p;
|
|
|
|
if (*p == '#') {
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
while (*p && (isalnum((int) *p) || *p == '_')) {
|
|
|
|
p++;
|
|
|
|
}
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/* copy variable to buffer */
|
2009-11-18 12:15:34 +00:00
|
|
|
len = (p - s > (int)text_buffer_size-1) ? (int)text_buffer_size-1 : (p - s);
|
2009-08-07 07:24:24 +00:00
|
|
|
strncpy(buf, s, len);
|
|
|
|
buf[len] = '\0';
|
|
|
|
|
|
|
|
if (*p == '}') {
|
|
|
|
p++;
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
2009-08-07 07:24:24 +00:00
|
|
|
s = p;
|
|
|
|
|
|
|
|
/* search for variable in environment */
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
var = getenv(buf);
|
|
|
|
if (var) {
|
|
|
|
obj = create_plain_text(var);
|
|
|
|
if (obj) {
|
|
|
|
append_object(retval, obj);
|
|
|
|
}
|
2009-12-17 21:19:58 +00:00
|
|
|
free(buf);
|
2009-08-06 06:54:40 +00:00
|
|
|
continue;
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/* if variable wasn't found in environment, use some special */
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
arg = 0;
|
|
|
|
|
|
|
|
/* split arg */
|
|
|
|
if (strchr(buf, ' ')) {
|
|
|
|
arg = strchr(buf, ' ');
|
|
|
|
*arg = '\0';
|
|
|
|
arg++;
|
|
|
|
while (isspace((int) *arg)) {
|
|
|
|
arg++;
|
|
|
|
}
|
|
|
|
if (!*arg) {
|
|
|
|
arg = 0;
|
|
|
|
}
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
/* lowercase variable name */
|
|
|
|
tmp_p = buf;
|
|
|
|
while (*tmp_p) {
|
|
|
|
*tmp_p = tolower(*tmp_p);
|
|
|
|
tmp_p++;
|
|
|
|
}
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
obj = construct_text_object(buf, arg,
|
|
|
|
line, &ifblock_opaque, orig_p);
|
|
|
|
if (obj != NULL) {
|
|
|
|
append_object(retval, obj);
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
2009-12-17 21:19:58 +00:00
|
|
|
free(buf);
|
2009-08-07 07:24:24 +00:00
|
|
|
continue;
|
2009-08-06 06:54:40 +00:00
|
|
|
} else {
|
2009-08-07 07:24:24 +00:00
|
|
|
obj = create_plain_text("$");
|
|
|
|
s = p + 1;
|
|
|
|
if (obj != NULL) {
|
|
|
|
append_object(retval, obj);
|
|
|
|
}
|
2009-08-06 06:54:40 +00:00
|
|
|
}
|
2009-08-07 07:24:24 +00:00
|
|
|
} else if (*p == '\\' && *(p+1) == '#') {
|
|
|
|
strfold(p, 1);
|
|
|
|
} else if (*p == '#') {
|
|
|
|
char c;
|
|
|
|
if (remove_comment(p, &c) && p > orig_p && c == '\n') {
|
|
|
|
/* if remove_comment removed a newline, we need to 'back up' with p */
|
|
|
|
p--;
|
2009-08-06 06:54:40 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-07 07:24:24 +00:00
|
|
|
p++;
|
2009-08-06 06:54:40 +00:00
|
|
|
}
|
2009-08-07 07:24:24 +00:00
|
|
|
obj = create_plain_text(s);
|
|
|
|
if (obj != NULL) {
|
|
|
|
append_object(retval, obj);
|
2009-08-06 06:54:40 +00:00
|
|
|
}
|
2009-08-07 07:24:24 +00:00
|
|
|
|
|
|
|
if (!ifblock_stack_empty(&ifblock_opaque)) {
|
|
|
|
NORM_ERR("one or more $endif's are missing");
|
2009-08-06 06:54:40 +00:00
|
|
|
}
|
2009-08-07 07:24:24 +00:00
|
|
|
|
|
|
|
free(orig_p);
|
|
|
|
return 0;
|
2009-08-06 06:54:40 +00:00
|
|
|
}
|
|
|
|
|
2009-12-28 01:57:12 +00:00
|
|
|
void extract_object_args_to_sub(struct text_object *obj, const char *args)
|
|
|
|
{
|
|
|
|
obj->sub = (struct text_object *)malloc(sizeof(struct text_object));
|
|
|
|
memset(obj->sub, 0, sizeof(struct text_object));
|
|
|
|
extract_variable_text_internal(obj->sub, args);
|
|
|
|
}
|
|
|
|
|
2009-11-29 20:24:03 +00:00
|
|
|
/* Frees the list of text objects root points to. */
|
|
|
|
void free_text_objects(struct text_object *root)
|
2009-08-06 06:54:40 +00:00
|
|
|
{
|
2009-08-07 07:24:24 +00:00
|
|
|
struct text_object *obj;
|
2009-08-06 06:54:40 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
if (!root->prev) {
|
2009-08-06 06:54:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
for (obj = root->prev; obj; obj = root->prev) {
|
|
|
|
root->prev = obj->prev;
|
2009-11-19 23:25:45 +00:00
|
|
|
|
|
|
|
if (obj->callbacks.free) {
|
|
|
|
(*obj->callbacks.free)(obj);
|
|
|
|
}
|
2009-11-29 19:50:22 +00:00
|
|
|
if(obj->sub) {
|
2009-11-29 20:24:03 +00:00
|
|
|
free_text_objects(obj->sub);
|
2009-11-29 19:50:22 +00:00
|
|
|
free(obj->sub);
|
|
|
|
}
|
2009-11-16 18:52:12 +00:00
|
|
|
if(obj->special_data)
|
|
|
|
free(obj->special_data);
|
2009-11-29 20:24:03 +00:00
|
|
|
|
2009-08-07 07:24:24 +00:00
|
|
|
free(obj);
|
2009-08-05 22:46:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|