summaryrefslogtreecommitdiff
path: root/slstatus.c
diff options
context:
space:
mode:
authorAli H. Fardan <raiz@firemail.cc>2016-09-05 01:21:03 +0300
committerAli H. Fardan <raiz@firemail.cc>2016-09-05 01:21:03 +0300
commita4beda8eb9bdf34d055ba52c39b15b9580b27e6a (patch)
treea9f8137a9e38207d4267e73cd5a8bce1cb989afb /slstatus.c
parent52d19f955e67712eab50f582046013246b6bc75d (diff)
bringed back the loop
Diffstat (limited to 'slstatus.c')
-rw-r--r--slstatus.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/slstatus.c b/slstatus.c
index 92cff2e..441c517 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -604,21 +604,23 @@ main(void)
stderr = stderr;
dpy = XOpenDisplay(NULL);
- memset(status_string, 0, sizeof(status_string));
- for (i = 0; i < sizeof(args) / sizeof(args[0]); ++i) {
- argument = args[i];
- if (argument.args == NULL)
- res = argument.func();
- else
- res = argument.func(argument.args);
- element = smprintf(argument.format, res);
- if (element == NULL) {
- element = smprintf(UNKNOWN_STR);
- fprintf(stderr, "Failed to format output.\n");
+ for (;;) {
+ memset(status_string, 0, sizeof(status_string));
+ for (i = 0; i < sizeof(args) / sizeof(args[0]); ++i) {
+ argument = args[i];
+ if (argument.args == NULL)
+ res = argument.func();
+ else
+ res = argument.func(argument.args);
+ element = smprintf(argument.format, res);
+ if (element == NULL) {
+ element = smprintf(UNKNOWN_STR);
+ fprintf(stderr, "Failed to format output.\n");
+ }
+ strlcat(status_string, element, sizeof(status_string));
+ free(res);
+ free(element);
}
- strlcat(status_string, element, sizeof(status_string));
- free(res);
- free(element);
}
XStoreName(dpy, DefaultRootWindow(dpy), status_string);