* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
- * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
{
struct information *tmp_info;
struct text_object subroot;
+ char *buf;
- read_exec(obj->data.s, p, p_max_size);
+ buf = malloc(text_buffer_size);
+ memset(buf, 0, text_buffer_size);
+
+ read_exec(obj->data.s, buf, text_buffer_size);
tmp_info = malloc(sizeof(struct information));
memcpy(tmp_info, &info, sizeof(struct information));
- parse_conky_vars(&subroot, p, p, tmp_info);
+ parse_conky_vars(&subroot, buf, p, p_max_size, tmp_info);
free_text_objects(&subroot, 1);
free(tmp_info);
+ free(buf);
}
void print_execi(struct text_object *obj, char *p, int p_max_size)
snprintf(p, p_max_size, "%s", ed->buffer);
}
-void print_execpi(struct text_object *obj, char *p)
+void print_execpi(struct text_object *obj, char *p, int p_max_size)
{
struct execi_data *ed = obj->data.opaque;
struct text_object subroot;
tmp_info = malloc(sizeof(struct information));
memcpy(tmp_info, &info, sizeof(struct information));
- if (!time_to_update(ed)) {
- parse_conky_vars(&subroot, ed->buffer, p, tmp_info);
- } else {
+ if (time_to_update(ed)) {
char *output;
int length;
FILE *fp = pid_popen(ed->cmd, "r", &childpid);
output[length - 1] = '\0';
}
- parse_conky_vars(&subroot, ed->buffer, p, tmp_info);
ed->last_update = current_update_time;
}
+ parse_conky_vars(&subroot, ed->buffer, p, p_max_size, tmp_info);
free_text_objects(&subroot, 1);
free(tmp_info);
}
}
}
-#ifdef X11
void print_execgauge(struct text_object *obj, char *p, int p_max_size)
{
double barnum;
if (barnum >= 0.0) {
barnum /= 100;
- new_gauge(obj, p, round_to_int(barnum * 255.0));
+ new_gauge(obj, p, p_max_size, round_to_int(barnum * 255.0));
}
}
+#ifdef X11
void print_execgraph(struct text_object *obj, char *p, int p_max_size)
{
double barnum;
barnum = get_barnum(p);
if (barnum > 0) {
- new_graph(obj, p, round_to_int(barnum));
+ new_graph(obj, p, p_max_size, round_to_int(barnum));
}
}
}
ed->last_update = current_update_time;
}
- new_graph(obj, p, (int) (ed->barnum));
+ new_graph(obj, p, p_max_size, (int) (ed->barnum));
}
+#endif /* X11 */
void print_execigauge(struct text_object *obj, char *p, int p_max_size)
{
}
ed->last_update = current_update_time;
}
- new_gauge(obj, p, round_to_int(ed->barnum));
+ new_gauge(obj, p, p_max_size, round_to_int(ed->barnum));
}
-#endif /* X11 */
void print_execbar(struct text_object *obj, char *p, int p_max_size)
{
barnum = get_barnum(p);
if (barnum >= 0.0) {
-#ifdef X11
- if(output_methods & TO_X) {
- barnum /= 100;
- new_bar(obj, p, round_to_int(barnum * 255.0));
- }else
-#endif /* X11 */
- new_bar_in_shell(obj, p, p_max_size, barnum);
+ barnum /= 100;
+ new_bar(obj, p, p_max_size, round_to_int(barnum * 255.0));
}
}
}
ed->last_update = current_update_time;
}
-#ifdef X11
- if(output_methods & TO_X) {
- new_bar(obj, p, round_to_int(ed->barnum * 2.55));
- } else
-#endif /* X11 */
- new_bar_in_shell(obj, p, p_max_size, round_to_int(ed->barnum));
+ new_bar(obj, p, p_max_size, round_to_int(ed->barnum * 2.55));
}
void free_exec(struct text_object *obj)