Reversed direction of keys for switch between monitors to match the physical arrangem...
[dwm] / util.c
CommitLineData
5715edf5
AT
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
9void
10die(const char *fmt, ...)
11{
12 va_list ap;
13
14 va_start(ap, fmt);
15 vfprintf(stderr, fmt, ap);
16 va_end(ap);
17
18 if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
19 fputc(' ', stderr);
20 perror(NULL);
21 } else {
22 fputc('\n', stderr);
23 }
24
25 exit(1);
26}
27
28void *
29ecalloc(size_t nmemb, size_t size)
30{
31 void *p;
32
33 if (!(p = calloc(nmemb, size)))
34 die("calloc:");
35 return p;
36}