summaryrefslogtreecommitdiff
path: root/wm/dwm-6.4/util.c
diff options
context:
space:
mode:
authorstkhan <personal@slickd.xyz>2023-03-11 16:39:07 -0600
committerstkhan <personal@slickd.xyz>2023-03-11 16:39:07 -0600
commit2083a177d2e3b069b0343bcbc3027fd4c5cf7dba (patch)
tree25dc50a4d0e997c372df7e0eb529e69be1011872 /wm/dwm-6.4/util.c
parente73a4b48c2d9bfe6faf6bca3772f948b1c8b4a24 (diff)
update to dwm 6.4
Diffstat (limited to 'wm/dwm-6.4/util.c')
-rw-r--r--wm/dwm-6.4/util.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/wm/dwm-6.4/util.c b/wm/dwm-6.4/util.c
new file mode 100644
index 0000000..96b82c9
--- /dev/null
+++ b/wm/dwm-6.4/util.c
@@ -0,0 +1,36 @@
+/* See LICENSE 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;
+}