Introduction
Introduction Statistics Contact Development Disclaimer Help
util.c - dwm - dynamic window manager
git clone git://git.suckless.org/dwm
Log
Files
Refs
README
LICENSE
---
util.c (572B)
---
1 /* See LICENSE file for copyright and license details. */
2 #include <errno.h>
3 #include <stdarg.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7
8 #include "util.h"
9
10 void
11 die(const char *fmt, ...)
12 {
13 va_list ap;
14 int saved_errno;
15
16 saved_errno = errno;
17
18 va_start(ap, fmt);
19 vfprintf(stderr, fmt, ap);
20 va_end(ap);
21
22 if (fmt[0] && fmt[strlen(fmt)-1] == ':')
23 fprintf(stderr, " %s", strerror(saved_errno));
24 fputc('\n', stderr);
25
26 exit(1);
27 }
28
29 void *
30 ecalloc(size_t nmemb, size_t size)
31 {
32 void *p;
33
34 if (!(p = calloc(nmemb, size)))
35 die("calloc:");
36 return p;
37 }
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.