bringed back the loop

This commit is contained in:
Ali H. Fardan 2016-09-05 01:21:03 +03:00
parent 52d19f955e
commit a4beda8eb9
1 changed files with 16 additions and 14 deletions

View File

@ -604,21 +604,23 @@ main(void)
stderr = stderr; stderr = stderr;
dpy = XOpenDisplay(NULL); dpy = XOpenDisplay(NULL);
memset(status_string, 0, sizeof(status_string)); for (;;) {
for (i = 0; i < sizeof(args) / sizeof(args[0]); ++i) { memset(status_string, 0, sizeof(status_string));
argument = args[i]; for (i = 0; i < sizeof(args) / sizeof(args[0]); ++i) {
if (argument.args == NULL) argument = args[i];
res = argument.func(); if (argument.args == NULL)
else res = argument.func();
res = argument.func(argument.args); else
element = smprintf(argument.format, res); res = argument.func(argument.args);
if (element == NULL) { element = smprintf(argument.format, res);
element = smprintf(UNKNOWN_STR); if (element == NULL) {
fprintf(stderr, "Failed to format output.\n"); 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); XStoreName(dpy, DefaultRootWindow(dpy), status_string);