diff options
| author | Matthias-Christian Ott <ott@enolink.de> | 2008-07-04 18:05:08 +0200 |
|---|---|---|
| committer | Matthias-Christian Ott <ott@enolink.de> | 2008-07-04 18:05:08 +0200 |
| commit | f982c1c37ccc4adc38260a132aa64ee29d1a1a8c (patch) | |
| tree | 5d2ca4b666b91eed75ce2b16c3cd7ab785e66838 /util.c | |
| parent | simplify flushing (diff) | |
| download | st-f982c1c37ccc4adc38260a132aa64ee29d1a1a8c.tar.gz st-f982c1c37ccc4adc38260a132aa64ee29d1a1a8c.zip | |
replace eprint() functions with BSD error functions
Diffstat (limited to '')
| -rw-r--r-- | util.c | 23 |
1 files changed, 1 insertions, 22 deletions
| @@ -11,27 +11,6 @@ emallocz(unsigned int size) { | |||
| 11 | void *res = calloc(1, size); | 11 | void *res = calloc(1, size); |
| 12 | 12 | ||
| 13 | if(!res) | 13 | if(!res) |
| 14 | eprint("fatal: could not malloc() %u bytes\n", size); | 14 | err(EXIT_FAILURE, "could not malloc() %u bytes\n", size); |
| 15 | return res; | 15 | return res; |
| 16 | } | 16 | } |
| 17 | |||
| 18 | void | ||
| 19 | eprint(const char *errstr, ...) { | ||
| 20 | va_list ap; | ||
| 21 | |||
| 22 | va_start(ap, errstr); | ||
| 23 | vfprintf(stderr, errstr, ap); | ||
| 24 | va_end(ap); | ||
| 25 | exit(EXIT_FAILURE); | ||
| 26 | } | ||
| 27 | |||
| 28 | void | ||
| 29 | eprintn(const char *errstr, ...) { | ||
| 30 | va_list ap; | ||
| 31 | |||
| 32 | va_start(ap, errstr); | ||
| 33 | vfprintf(stderr, errstr, ap); | ||
| 34 | va_end(ap); | ||
| 35 | fprintf(stderr, ": %s\n", strerror(errno)); | ||
| 36 | exit(EXIT_FAILURE); | ||
| 37 | } | ||
