libexplain
1.4.D001
|
#include <libexplain/ac/errno.h>
#include <libexplain/ac/iconv.h>
#include <libexplain/iconv.h>
#include <libexplain/output.h>
Go to the source code of this file.
Defines | |
#define | ICONV_FAIL ((size_t)(-1)) |
Functions | |
size_t | explain_iconv_or_die (iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
size_t | explain_iconv_on_error (iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
#define ICONV_FAIL ((size_t)(-1)) |
Definition at line 26 of file iconv_or_die.c.
size_t explain_iconv_on_error | ( | iconv_t | cd, |
char ** | inbuf, | ||
size_t * | inbytesleft, | ||
char ** | outbuf, | ||
size_t * | outbytesleft | ||
) |
The explain_iconv_on_error function is used to call the iconv(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_iconv(3) function.
cd | The cd, exactly as to be passed to the iconv(3) system call. |
inbuf | The inbuf, exactly as to be passed to the iconv(3) system call. |
inbytesleft | The inbytesleft, exactly as to be passed to the iconv(3) system call. |
outbuf | The outbuf, exactly as to be passed to the iconv(3) system call. |
outbytesleft | The outbytesleft, exactly as to be passed to the iconv(3) system call. |
errno = 0; size_t result = explain_iconv_on_error(cd, inbuf, inbytesleft, outbuf, outbytesleft); if (result < 0 && errno != 0) { ...cope with error ...no need to print error message }
Definition at line 50 of file iconv_or_die.c.
size_t explain_iconv_or_die | ( | iconv_t | cd, |
char ** | inbuf, | ||
size_t * | inbytesleft, | ||
char ** | outbuf, | ||
size_t * | outbytesleft | ||
) |
The explain_iconv_or_die function is used to call the iconv(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_iconv(3) function, and then the process terminates by calling exit(EXIT_FAILURE)
.
cd | The cd, exactly as to be passed to the iconv(3) system call. |
inbuf | The inbuf, exactly as to be passed to the iconv(3) system call. |
inbytesleft | The inbytesleft, exactly as to be passed to the iconv(3) system call. |
outbuf | The outbuf, exactly as to be passed to the iconv(3) system call. |
outbytesleft | The outbytesleft, exactly as to be passed to the iconv(3) system call. |
size_t result = explain_iconv_or_die(cd, inbuf, inbytesleft, outbuf, outbytesleft);
Definition at line 30 of file iconv_or_die.c.