X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/fa8b939990ed0648f99b0cbeba4efed807160db3..f17f39d0a2e2898177dbcf5daf67284956005b9b:/slstatus.c diff --git a/slstatus.c b/slstatus.c index b3abafb..4f7a2fc 100644 --- a/slstatus.c +++ b/slstatus.c @@ -42,7 +42,7 @@ difftimespec(struct timespec *res, struct timespec *a, struct timespec *b) static void usage(void) { - die("usage: %s [-so]", argv0); + die("usage: %s [-s]", argv0); } int @@ -51,18 +51,15 @@ main(int argc, char *argv[]) struct sigaction act; struct timespec start, current, diff, intspec, wait; size_t i, len; - int sflag, oflag, ret; + int sflag, ret; char status[MAXLEN]; const char *res; - sflag = oflag = 0; + sflag = 0; ARGBEGIN { case 's': sflag = 1; break; - case 'o': - oflag = 1; - break; default: usage(); } ARGEND @@ -102,7 +99,9 @@ main(int argc, char *argv[]) } if (sflag) { - printf("%s\n", status); + if (printf("%s\n", status) < 0) { + die("printf:"); + } } else { if (XStoreName(dpy, DefaultRootWindow(dpy), status) < 0) { die("XStoreName: Allocation failed"); @@ -110,10 +109,6 @@ main(int argc, char *argv[]) XFlush(dpy); } - if (oflag) { - done = 1; - } - if (!done) { if (clock_gettime(CLOCK_MONOTONIC, ¤t) < 0) { die("clock_gettime:");