Xinqi Bao's Git

dmenu: style improvements
[dmenu.git] / util.c
1 /* See LICENSE file for copyright and license details. */
2 #include <stdarg.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6
7 #include "util.h"
8
9 void
10 die(const char *fmt, ...) {
11 va_list ap;
12
13 va_start(ap, fmt);
14 vfprintf(stderr, fmt, ap);
15 va_end(ap);
16
17 if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
18 fputc(' ', stderr);
19 perror(NULL);
20 }
21
22 exit(1);
23 }