1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +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

@ -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));