mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-05 21:07:52 +00:00
fix my own fix
The second parameter is optional, so have conky act accordingly. This time I tested using either two or three params and it worked flawlessly. git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1269 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
f44003e07c
commit
820e0d24c4
@ -4215,11 +4215,13 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(entropy_bar, INFO_ENTROPY)
|
||||
scan_bar(arg, &obj->a, &obj->b);
|
||||
END OBJ(scroll, 0)
|
||||
int n;
|
||||
int n1, n2;
|
||||
|
||||
obj->data.scroll.step = 1;
|
||||
if (arg && sscanf(arg, "%u %u %n", &obj->data.scroll.show, &obj->data.scroll.step, &n) >= 2) {
|
||||
obj->data.scroll.text = strndup(arg + n, text_buffer_size);
|
||||
if (arg && sscanf(arg, "%u %n", &obj->data.scroll.show, &n1) > 0) {
|
||||
if (sscanf(arg + n1, "%u %n", &obj->data.scroll.step, &n2) > 0)
|
||||
n1 += n2;
|
||||
obj->data.scroll.text = strndup(arg + n1, text_buffer_size);
|
||||
obj->data.scroll.start = 0;
|
||||
} else {
|
||||
CRIT_ERR("scroll needs arguments: <length> [<step>] <text>");
|
||||
|
Loading…
Reference in New Issue
Block a user