X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/9ca1ac62f9aa6e01afb3697cc4b966d085be9d3a..fc8b6f81a54810faa844ea21d08ef47f95b8f4e0:/slstatus.c diff --git a/slstatus.c b/slstatus.c index 19bc127..e8d367b 100644 --- a/slstatus.c +++ b/slstatus.c @@ -1,6 +1,4 @@ /* See LICENSE file for copyright and license details. */ -#include -#include #include #include #include @@ -21,7 +19,7 @@ struct arg { char *argv0; char buf[1024]; -static unsigned short int done; +static int done; static Display *dpy; #include "config.h" @@ -55,9 +53,10 @@ main(int argc, char *argv[]) struct sigaction act; struct timespec start, current, diff, intspec, wait; size_t i, len; - int sflag = 0; + int sflag; char status[MAXLEN]; + sflag = 0; ARGBEGIN { case 's': sflag = 1; @@ -78,7 +77,7 @@ main(int argc, char *argv[]) sigaction(SIGTERM, &act, NULL); if (!sflag && !(dpy = XOpenDisplay(NULL))) { - fprintf(stderr, "slstatus: cannot open display"); + fprintf(stderr, "Cannot open display"); return 1; } @@ -99,6 +98,7 @@ main(int argc, char *argv[]) if (sflag) { printf("%s\n", status); + fflush(stdout); } else { XStoreName(dpy, DefaultRootWindow(dpy), status); XSync(dpy, False);