diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-10-20 23:34:49 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-10-20 23:38:31 +0200 |
commit | 646b351cc79845f4cc77415dfff474b9ae0053d9 (patch) | |
tree | d3de639691f7f845a705007e93560160d3b3ee5c /util.c | |
parent | e3b7e1d620e18818222c1e5033356ae29dd49e7f (diff) | |
download | dwm-646b351cc79845f4cc77415dfff474b9ae0053d9.tar.gz |
sync updated drw code from dmenu
important:
- drw_rect: didn't use w and h, change the dwm code accordingly.
- drw_text: text is NULL is not allowed, use drw_rect().
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -2,16 +2,32 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "util.h" +void * +ecalloc(size_t nmemb, size_t size) +{ + void *p; + + if (!(p = calloc(nmemb, size))) + perror(NULL); + return p; +} + void -die(const char *errstr, ...) { +die(const char *fmt, ...) { va_list ap; - va_start(ap, errstr); - vfprintf(stderr, errstr, ap); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); va_end(ap); - exit(EXIT_FAILURE); -} + if (fmt[0] && fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } + + exit(1); +} |