X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/c4779c9b15b5138d1dfcf1d706d88baff36f5bd3..3468a6e368974ea222ab81c389e0800748541c42:/slstatus.c diff --git a/slstatus.c b/slstatus.c index f47cd9f..cd6cc8f 100644 --- a/slstatus.c +++ b/slstatus.c @@ -1,5 +1,4 @@ /* See LICENSE file for copyright and license details. */ - #include #include #include @@ -36,7 +35,6 @@ struct arg { 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); @@ -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 void sighandler(const int signo); -static void usage(void); char *argv0; static unsigned short int delay = 0; @@ -841,11 +837,9 @@ wifi_essid(const char *iface) } static void -sighandler(const int signo) +terminate(const int signo) { - if (signo == SIGTERM || signo == SIGINT) { - done = 1; - } + done = 1; } static void @@ -878,9 +872,9 @@ main(int argc, char *argv[]) } 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);