1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-29 21:49:07 +00:00

misc.cc: Evaluate the result and then parse it to capitalize

This commit is contained in:
su8 2018-08-20 14:36:55 +02:00 committed by lasers
parent f2ca86cca0
commit 5980fb4a52
2 changed files with 8 additions and 4 deletions

View File

@ -486,7 +486,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
obj->data.i = atoi(&arg[0]);
}
obj->callbacks.print = &print_voltage_v;
#endif /* __linux__ */
#ifdef BUILD_WLAN
@ -522,7 +522,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
parse_net_stat_bar_arg(obj, arg, free_at_crash);
obj->callbacks.barval = &wireless_link_barval;
#endif /* BUILD_WLAN */
#ifndef __OpenBSD__
END OBJ(acpifan, nullptr) obj->callbacks.print = &print_acpifan;
END OBJ(battery, nullptr) char bat[64];
@ -845,10 +845,9 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
END OBJ(freq2, 0) obj->callbacks.print = &print_freq2;
#endif /* __x86_64__ */
END OBJ(cap, 0) obj->data.s = STRNDUP_ARG;
END OBJ(start_case, 0) obj->data.s = STRNDUP_ARG;
obj->callbacks.print = &print_cap;
obj->callbacks.free = &gen_free_opaque;
END OBJ(catp, 0) obj->data.s = STRNDUP_ARG;
obj->callbacks.print = &print_catp;
obj->callbacks.free = &gen_free_opaque;

View File

@ -101,6 +101,11 @@ void print_cap(struct text_object *obj, char *p, unsigned int p_max_size) {
char *src = obj->data.s;
char *dest = buf;
evaluate(obj->data.s, p, p_max_size);
if (0 != strcmp(p, "")) {
src = p;
}
for (; *src && p_max_size-1 > x; src++, x++) {
if (0 == z) {
*dest++ = (toupper((unsigned char) *src));