Introduction
Introduction Statistics Contact Development Disclaimer Help
util.c - sent - simple plaintext presentation tool
git clone git://git.suckless.org/sent
Log
Files
Refs
README
LICENSE
---
util.c (517B)
---
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
9 void *
10 ecalloc(size_t nmemb, size_t size)
11 {
12 void *p;
13
14 if (!(p = calloc(nmemb, size)))
15 die("calloc:");
16 return p;
17 }
18
19 void
20 die(const char *fmt, ...) {
21 va_list ap;
22
23 va_start(ap, fmt);
24 vfprintf(stderr, fmt, ap);
25 va_end(ap);
26
27 if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
28 fputc(' ', stderr);
29 perror(NULL);
30 } else {
31 fputc('\n', stderr);
32 }
33
34 exit(1);
35 }
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.