ewrite3
Exit-on-failure wrapper functions
Part of ecalloc(3).
Usage
#include <roken.h>
void *
ecalloc(size_t number, size_t size);
void *
emalloc(size_t sz);
ssize_t
eread(int fd, void *buf, size_t nbytes);
void *
erealloc(void *ptr, size_t sz);
void
esetenv(const char *var, const char *val, int rewrite);
char *
estrdup(const char *str);
ssize_t
ewrite(int fd, const void *buf, size_t nbytes);
Library
The roken library (libroken, -lroken)
Overview
These functions do the same as the ones without the “e” prefix, but if there is an error they will print a message with errx(3), and exit. For eread and ewrite this is also true for partial data.
This is useful in applications when there is no need for a more advanced failure mode.
Releases
9 releases since Debian 5.0 (Lenny); the text changed 2 times.