[wiki] [sites] [slstatus][patch][signals] simplify logic || sewn
commit 499c620cb7b1f3018e53fca61d38918612bbcbc2
Author: sewn <sewn_AT_disroot.org>
Date: Fri Sep 13 11:53:43 2024 +0300
[slstatus][patch][signals] simplify logic
diff --git a/tools.suckless.org/slstatus/patches/signals/slstatus-signals-1.0.patch b/tools.suckless.org/slstatus/patches/signals/slstatus-signals-1.0.patch
index dd9f60aa..946ff120 100644
--- a/tools.suckless.org/slstatus/patches/signals/slstatus-signals-1.0.patch
+++ b/tools.suckless.org/slstatus/patches/signals/slstatus-signals-1.0.patch
_AT_@ -1,12 +1,12 @@
-From 08c9d252bb855b5a77b9bbcd29b31b71219d0e72 Mon Sep 17 00:00:00 2001
+From 7ec52e9f292fa50fae646d89302a3aa0c326b83e Mon Sep 17 00:00:00 2001
From: sewn <sewn_AT_disroot.org>
-Date: Thu, 2 May 2024 15:53:30 +0300
+Date: Fri, 13 Sep 2024 11:51:02 +0300
Subject: [PATCH] implement signals & intervals
---
config.def.h | 11 ++++--
- slstatus.c | 110 +++++++++++++++++++++++++++++++++------------------
- 2 files changed, 78 insertions(+), 43 deletions(-)
+ slstatus.c | 109 +++++++++++++++++++++++++++++++++------------------
+ 2 files changed, 77 insertions(+), 43 deletions(-)
diff --git a/config.def.h b/config.def.h
index d805331..7fbd164 100644
_AT_@ -36,7 +36,7 @@ index d805331..7fbd164 100644
+/* maximum output string length */
+#define MAXLEN CMDLEN * LEN(args)
diff --git a/slstatus.c b/slstatus.c
-index fd31313..2c953cc 100644
+index fd31313..41ef7a9 100644
--- a/slstatus.c
+++ b/slstatus.c
_AT_@ -15,20 +15,19 @@ struct arg {
_AT_@ -65,7 +65,7 @@ index fd31313..2c953cc 100644
static void
difftimespec(struct timespec *res, struct timespec *a, struct timespec *b)
-_AT_@ -44,17 +43,67 @@ usage(void)
+_AT_@ -44,17 +43,68 @@ usage(void)
die("usage: %s [-v] [-s] [-1]", argv0);
}
_AT_@ -78,8 +78,9 @@ index fd31313..2c953cc 100644
+ const char *res;
+
+ for (i = 0; i < LEN(args); i++) {
-+ if (!(((args[i].interval > 0 && it > 0 && !(it % args[i].interval)) && upsig < 0) ||
-+ (upsig > -1 && args[i].signal == upsig) || (it == -1 && upsig == -1)))
++ if (!((args[i].interval > 0 && !(it % args[i].interval)) ||
++ (!it || (args[i].signal > -1 && upsig == args[i].signal)) ||
++ (it < 0 && upsig < 0)))
+ continue;
+
+ update = 1;
_AT_@ -138,7 +139,7 @@ index fd31313..2c953cc 100644
ARGBEGIN {
case 'v':
die("slstatus-"VERSION);
-_AT_@ -72,41 +121,23 @@ main(int argc, char *argv[])
+_AT_@ -72,11 +122,12 @@ main(int argc, char *argv[])
usage();
memset(&act, 0, sizeof(act));
_AT_@ -153,10 +154,7 @@ index fd31313..2c953cc 100644
if (!sflag && !(dpy = XOpenDisplay(NULL)))
die("XOpenDisplay: Failed to open display");
-
-+ printstatus(-1, -1);
-+
- do {
+_AT_@ -85,28 +136,7 @@ main(int argc, char *argv[])
if (clock_gettime(CLOCK_MONOTONIC, &start) < 0)
die("clock_gettime:");
_AT_@ -186,7 +184,7 @@ index fd31313..2c953cc 100644
if (!done) {
if (clock_gettime(CLOCK_MONOTONIC, ¤t) < 0)
-_AT_@ -117,10 +148,11 @@ main(int argc, char *argv[])
+_AT_@ -117,10 +147,11 @@ main(int argc, char *argv[])
intspec.tv_nsec = (interval % 1000) * 1E6;
difftimespec(&wait, &intspec, &diff);
_AT_@ -203,5 +201,5 @@ index fd31313..2c953cc 100644
} while (!done);
--
-2.44.0
+2.46.0
Received on Fri Sep 13 2024 - 10:54:31 CEST
This archive was generated by hypermail 2.3.0
: Fri Sep 13 2024 - 11:00:53 CEST