Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Simplify signal handling a bit
[slstatus.git]
/
slstatus.c
diff --git
a/slstatus.c
b/slstatus.c
index
f47cd9f
..
cd6cc8f
100644
(file)
--- a/
slstatus.c
+++ b/
slstatus.c
@@
-1,5
+1,4
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
-
#include <dirent.h>
#include <err.h>
#include <fcntl.h>
#include <dirent.h>
#include <err.h>
#include <fcntl.h>
@@
-36,7
+35,6
@@
struct arg {
const char *args;
};
const char *args;
};
-static const char *bprintf(const char *fmt, ...);
static const char *battery_perc(const char *bat);
static const char *battery_power(const char *bat);
static const char *battery_state(const char *bat);
static const char *battery_perc(const char *bat);
static const char *battery_power(const char *bat);
static const char *battery_state(const char *bat);
@@
-71,8
+69,6
@@
static const char *username(void);
static const char *vol_perc(const char *card);
static const char *wifi_perc(const char *iface);
static const char *wifi_essid(const char *iface);
static const char *vol_perc(const char *card);
static const char *wifi_perc(const char *iface);
static const char *wifi_essid(const char *iface);
-static void sighandler(const int signo);
-static void usage(void);
char *argv0;
static unsigned short int delay = 0;
char *argv0;
static unsigned short int delay = 0;
@@
-841,11
+837,9
@@
wifi_essid(const char *iface)
}
static void
}
static void
-
sighandler
(const int signo)
+
terminate
(const int signo)
{
{
- if (signo == SIGTERM || signo == SIGINT) {
- done = 1;
- }
+ done = 1;
}
static void
}
static void
@@
-878,9
+872,9
@@
main(int argc, char *argv[])
}
memset(&act, 0, sizeof(act));
}
memset(&act, 0, sizeof(act));
- act.sa_handler =
sighandler
;
- sigaction(SIGINT, &act,
0
);
- sigaction(SIGTERM, &act,
0
);
+ act.sa_handler =
terminate
;
+ sigaction(SIGINT, &act,
NULL
);
+ sigaction(SIGTERM, &act,
NULL
);
if (!sflag) {
dpy = XOpenDisplay(NULL);
if (!sflag) {
dpy = XOpenDisplay(NULL);