1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 20:44:56 +00:00

Combine print_execi and print_execpi as much as possible

This commit is contained in:
Nikolas Garofil 2010-02-10 15:02:00 +01:00
parent b601c21c04
commit 456142241c
3 changed files with 8 additions and 21 deletions

View File

@ -623,7 +623,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ_ARG(execpi, 0, "execpi needs arguments")
scan_execi_arg(obj, arg);
obj->verbatim_output = 1;
obj->callbacks.print = &print_execpi;
obj->parse = true;
obj->callbacks.print = &print_execi;
obj->callbacks.free = &free_execi;
END OBJ_ARG(texeci, 0, "texeci needs arguments")
scan_execi_arg(obj, arg);

View File

@ -323,26 +323,11 @@ void print_execi(struct text_object *obj, char *p, int p_max_size)
read_exec(ed->cmd, ed->buffer, text_buffer_size);
ed->last_update = current_update_time;
}
snprintf(p, p_max_size, "%s", ed->buffer);
}
void print_execpi(struct text_object *obj, char *p, int p_max_size)
{
struct execi_data *ed = (struct execi_data *)obj->data.opaque;
struct text_object subroot;
if (!ed)
return;
if (time_to_update(ed)) {
if (!ed->buffer)
ed->buffer = (char*)malloc(text_buffer_size);
read_exec(ed->cmd, ed->buffer, text_buffer_size);
ed->last_update = current_update_time;
}
parse_conky_vars(&subroot, ed->buffer, p, p_max_size);
free_text_objects(&subroot);
if(obj->parse == true) {
struct text_object subroot;
parse_conky_vars(&subroot, ed->buffer, p, p_max_size);
free_text_objects(&subroot);
} else snprintf(p, p_max_size, "%s", ed->buffer);
}
char* threaded_exec_caller(struct text_object *obj) {

View File

@ -95,6 +95,7 @@ struct text_object {
void *special_data;
long line;
struct obj_cb callbacks;
bool parse; //if this true then data.s should still be parsed
};
/* text object list helpers */