From 5980fb4a5231b675de1efe1ee9a695b7d37a5e71 Mon Sep 17 00:00:00 2001 From: su8 Date: Mon, 20 Aug 2018 14:36:55 +0200 Subject: [PATCH] misc.cc: Evaluate the result and then parse it to capitalize --- src/core.cc | 7 +++---- src/misc.cc | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core.cc b/src/core.cc index b50c90d8..4aff963d 100644 --- a/src/core.cc +++ b/src/core.cc @@ -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; diff --git a/src/misc.cc b/src/misc.cc index f8046ca8..7dc78f0e 100644 --- a/src/misc.cc +++ b/src/misc.cc @@ -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));