about summary refs log tree commit diff
path: root/util.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-05-04 21:54:46 +0200
committerAnselm R Garbe <garbeam@gmail.com>2015-06-27 21:47:10 +0200
commit4b1fecd44e8376594c418663351fcb30c4e841de (patch)
tree78db12fd7024bff8afb3c3bd8851c009837f5a34 /util.c
parentapplied Hiltjo's patch as suggested on the ml to fix ControlMask for C-j and C-m (diff)
downloaddmenu-4b1fecd44e8376594c418663351fcb30c4e841de.tar.gz
dmenu-4b1fecd44e8376594c418663351fcb30c4e841de.tar.bz2
dmenu-4b1fecd44e8376594c418663351fcb30c4e841de.zip
Use libdraw: add Xft and fallback-fonts support to graphics lib
- libdraw, util: add drw.{c,h}, util.{c,h} and update code.
- libdraw: fix drw_rect(): use w and h parameter.
- libdraw: print errstr if last character in string was ":" (sbase).
- libdraw: drw_clr_free() allow valid free(NULL).
- config.def.h: set default font to monospace.
- cleanup() on exit.
- LICENSE: update license string for dmenu -v to 2015.
- LICENSE: add myself to LICENSE
Diffstat (limited to 'util.c')
-rw-r--r--util.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/util.c b/util.c
new file mode 100644
index 0000000..9b27512
--- /dev/null
+++ b/util.c
@@ -0,0 +1,23 @@
+/* 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);
+	}
+
+	exit(1);
+}