💾 Archived View for gemini.rmf-dev.com › repo › Vaati › fdwm › files › 96b82c980c4ce304d329fc60e5823… captured on 2023-01-29 at 17:35:30. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
0 /* See LICENSE file for copyright and license details. */
1 #include <stdarg.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 #include "util.h"
7
8 void
9 die(const char *fmt, ...)
10 {
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 } else {
21 fputc('\n', stderr);
22 }
23
24 exit(1);
25 }
26
27 void *
28 ecalloc(size_t nmemb, size_t size)
29 {
30 void *p;
31
32 if (!(p = calloc(nmemb, size)))
33 die("calloc:");
34 return p;
35 }
36