summaryrefslogtreecommitdiff
path: root/dwl/util.c
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2023-02-14 20:34:12 +0100
committertslil clingman <tslil@posteo.de>2023-02-14 20:34:54 +0100
commit819d795ba8472cc0c5b9f1f58fd4422d8c41ec71 (patch)
tree72fc3a44b7e654c2d7f83b32f52fdb205b8aa11d /dwl/util.c
parente9d8f093021dc416a5c790e2161d047426db2592 (diff)
[dwl] merge main, fix pertag/view(0), rule can prevent client focus
Diffstat (limited to 'dwl/util.c')
-rw-r--r--dwl/util.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/dwl/util.c b/dwl/util.c
new file mode 100644
index 0000000..cca7c19
--- /dev/null
+++ b/dwl/util.c
@@ -0,0 +1,35 @@
+/* See LICENSE.dwm file for copyright and license details. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "util.h"
+
+void
+die(const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+
+ if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
+ fputc(' ', stderr);
+ perror(NULL);
+ } else {
+ fputc('\n', stderr);
+ }
+
+ exit(1);
+}
+
+void *
+ecalloc(size_t nmemb, size_t size)
+{
+ void *p;
+
+ if (!(p = calloc(nmemb, size)))
+ die("calloc:");
+ return p;
+}