X-Git-Url: https://git.danieliu.xyz/?p=dmenu.git;a=blobdiff_plain;f=util.c;fp=util.c;h=9b27512e1efe5fb258b7fa65a07b476fb0bc27fc;hp=0000000000000000000000000000000000000000;hb=4b1fecd44e8376594c418663351fcb30c4e841de;hpb=13a529ce63364544bdc851dfd5d3aa2ef8740914 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 +#include +#include +#include + +#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); +}