mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-05 13:38:33 +00:00
Added lower_case and upper_case commands
This commit is contained in:
parent
6ad788b78d
commit
1bb8754dce
@ -3847,7 +3847,27 @@
|
|||||||
</command>
|
</command>
|
||||||
<option>text</option>
|
<option>text</option>
|
||||||
</term>
|
</term>
|
||||||
<listitem>All words capitalized regardless.
|
<listitem>Capitalises the start of each word.
|
||||||
|
<para /></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>
|
||||||
|
<option>lower_case</option>
|
||||||
|
</command>
|
||||||
|
<option>text</option>
|
||||||
|
</term>
|
||||||
|
<listitem>Converts all letters into lowercase.
|
||||||
|
<para /></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>
|
||||||
|
<option>upper_case</option>
|
||||||
|
</command>
|
||||||
|
<option>text</option>
|
||||||
|
</term>
|
||||||
|
<listitem>Converts all letters into uppercase.
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -886,6 +886,12 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
|||||||
END OBJ(start_case, 0) obj->data.s = STRNDUP_ARG;
|
END OBJ(start_case, 0) obj->data.s = STRNDUP_ARG;
|
||||||
obj->callbacks.print = &print_cap;
|
obj->callbacks.print = &print_cap;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
|
END OBJ(lower_case, 0) obj->data.s = STRNDUP_ARG;
|
||||||
|
obj->callbacks.print = &print_lower;
|
||||||
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
|
END OBJ(upper_case, 0) obj->data.s = STRNDUP_ARG;
|
||||||
|
obj->callbacks.print = &print_upper;
|
||||||
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
END OBJ(catp, 0) obj->data.s = STRNDUP_ARG;
|
END OBJ(catp, 0) obj->data.s = STRNDUP_ARG;
|
||||||
obj->callbacks.print = &print_catp;
|
obj->callbacks.print = &print_catp;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
|
16
src/misc.cc
16
src/misc.cc
@ -108,6 +108,22 @@ void print_cap(struct text_object *obj, char *p, unsigned int p_max_size) {
|
|||||||
snprintf(p, p_max_size, "%s", buf);
|
snprintf(p, p_max_size, "%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_lower(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
|
evaluate(obj->data.s, p, p_max_size);
|
||||||
|
for (unsigned int x = 0; x < p_max_size-1 && p[x]; x++) {
|
||||||
|
p[x] = tolower(p[x]);
|
||||||
|
}
|
||||||
|
p[p_max_size-1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_upper(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
|
evaluate(obj->data.s, p, p_max_size);
|
||||||
|
for (unsigned int x = 0; x < p_max_size-1 && p[x]; x++) {
|
||||||
|
p[x] = toupper(p[x]);
|
||||||
|
}
|
||||||
|
p[p_max_size-1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
long long int apply_base_multiplier(const char *s, long long int num) {
|
long long int apply_base_multiplier(const char *s, long long int num) {
|
||||||
long long int base = 1024LL;
|
long long int base = 1024LL;
|
||||||
if (*s && (0 == (strcmp(s, "si")))) { base = 1000LL; }
|
if (*s && (0 == (strcmp(s, "si")))) { base = 1000LL; }
|
||||||
|
@ -36,5 +36,7 @@
|
|||||||
void print_cat(struct text_object *, char *, unsigned int);
|
void print_cat(struct text_object *, char *, unsigned int);
|
||||||
void print_catp(struct text_object *, char *, unsigned int);
|
void print_catp(struct text_object *, char *, unsigned int);
|
||||||
void print_cap(struct text_object *, char *, unsigned int);
|
void print_cap(struct text_object *, char *, unsigned int);
|
||||||
|
void print_lower(struct text_object *, char *, unsigned int);
|
||||||
|
void print_upper(struct text_object *, char *, unsigned int);
|
||||||
long long apply_base_multiplier(const char *, long long int);
|
long long apply_base_multiplier(const char *, long long int);
|
||||||
#endif /* _MISC_H */
|
#endif /* _MISC_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user