EFUN(3)

NAME
esetfunc, easprintf, efopen, emalloc, ecalloc, erealloc, estrdup, estrlcat, estrlcpy, evasprintf - error-checked utility functions

LIBRARY
libutil

SYNOPSIS
#include <util.h>
void (*)(int, const char *, ...)
esetfunc(void (*)(int, const char *, ...));
int
easprintf(char ** restrict str, const char * restrict fmt, ...);
FILE *
efopen(const char *p, const char *m);
void *
ecalloc(size_t n, size_t c);
void *
emalloc(size_t n);
void *
erealloc(void *p, size_t n);
char *
estrdup(const char *s);
size_t
estrlcat(char *dst, const char *src, size_t len);
size_t
estrlcpy(char *dst, const char *src, size_t len);
int
evasprintf(char ** restrict str, const char * restrict fmt, ...);

DESCRIPTION
The easprintf, efopen, ecalloc, emalloc, erealloc, estrdup, estrlcat, estrlcpy, and evasprintf functions operate exactly as the correspoding functions that do not start with an ‘e’ except that they call the installed error handler that can be configured with esetfunc. The default error handler is err(3). The function esetfunc returns the previous error handler function. A NULL error handler will just call exit(3).

SEE ALSO
asprintf(3), calloc(3), err(3), exit(3), fopen(3), malloc(3), realloc(3), strdup(3), strlcat(3), strlcpy(3), vasprintf(3)