Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Get rid of err.h as it is not portable
[slstatus.git]
/
slstatus.c
diff --git
a/slstatus.c
b/slstatus.c
index
b4eb761
..
f7c4503
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>
@@
-10,6
+8,7
@@
#include <X11/Xlib.h>
#include "arg.h"
#include <X11/Xlib.h>
#include "arg.h"
+#include "slstatus.h"
#include "util.h"
struct arg {
#include "util.h"
struct arg {
@@
-19,15
+18,17
@@
struct arg {
};
char *argv0;
};
char *argv0;
+char buf[1024];
static unsigned short int done;
static Display *dpy;
static unsigned short int done;
static Display *dpy;
-#include "slstatus.h"
#include "config.h"
static void
terminate(const int signo)
{
#include "config.h"
static void
terminate(const int signo)
{
+ (void)signo;
+
done = 1;
}
done = 1;
}
@@
-84,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';