diff options
| author | tslil clingman <tslil@posteo.de> | 2023-02-12 09:56:17 +0100 |
|---|---|---|
| committer | tslil clingman <tslil@posteo.de> | 2023-02-12 09:56:17 +0100 |
| commit | 67a0b90589cbd2f7e61d307b9aaa57f450df0e47 (patch) | |
| tree | b22ce13141c3639c157a5aa59ef75b3bcc6d7e30 /dwl-0.4/util.c | |
| parent | 2915c2984e81251256a9dbe6eb64c8ff950279d0 (diff) | |
[dwl-0.4] tracking local build
Diffstat (limited to 'dwl-0.4/util.c')
| -rw-r--r-- | dwl-0.4/util.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/dwl-0.4/util.c b/dwl-0.4/util.c new file mode 100644 index 0000000..cca7c19 --- /dev/null +++ b/dwl-0.4/util.c @@ -0,0 +1,35 @@ +/* See LICENSE.dwm file for copyright and license details. */ +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#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); + } else { + fputc('\n', stderr); + } + + exit(1); +} + +void * +ecalloc(size_t nmemb, size_t size) +{ + void *p; + + if (!(p = calloc(nmemb, size))) + die("calloc:"); + return p; +} |
