Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Sort LICENSE according to first commit
[slstatus.git]
/
slstatus.c
diff --git
a/slstatus.c
b/slstatus.c
index
89a3268
..
b05d915
100644
(file)
--- a/
slstatus.c
+++ b/
slstatus.c
@@
-1,6
+1,4
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
-#include <err.h>
-#include <errno.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
@@
-78,7
+76,7
@@
main(int argc, char *argv[])
sigaction(SIGTERM, &act, NULL);
if (!sflag && !(dpy = XOpenDisplay(NULL))) {
sigaction(SIGTERM, &act, NULL);
if (!sflag && !(dpy = XOpenDisplay(NULL))) {
- fprintf(stderr, "
slstatus: c
annot open display");
+ fprintf(stderr, "
C
annot open display");
return 1;
}
return 1;
}
@@
-87,8
+85,10
@@
main(int argc, char *argv[])
status[0] = '\0';
for (i = len = 0; i < LEN(args); i++) {
status[0] = '\0';
for (i = len = 0; i < LEN(args); i++) {
+ const char * res = args[i].func(args[i].args);
+ res = (res == NULL) ? unknown_str : res;
len += snprintf(status + len, sizeof(status) - len,
len += snprintf(status + len, sizeof(status) - len,
- args[i].fmt,
args[i].func(args[i].args)
);
+ args[i].fmt,
res
);
if (len >= sizeof(status)) {
status[sizeof(status) - 1] = '\0';
if (len >= sizeof(status)) {
status[sizeof(status) - 1] = '\0';