eread (3) - Linux Manuals


ecalloc emalloc eread erealloc esetenv estrdup ewrite - exit-on-failure wrapper functions


The roken library (libroken, -lroken)


Fd #include <roken.h> Ft void * Fn ecalloc size_t number size_t size Ft void * Fn emalloc size_t sz Ft ssize_t Fn eread int fd void *buf size_t nbytes Ft void * Fn erealloc void *ptr size_t sz Ft void Fn esetenv const char *var const char *val int rewrite Ft char * Fn estrdup const char *str Ft ssize_t Fn ewrite int fd const void *buf size_t nbytes


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.


read(2), write(2), calloc(3), errx(3), malloc(3), realloc(3), setenv(3), strdup(3)