1explain_iconv_close(3)     Library Functions Manual     explain_iconv_close(3)
2
3
4

NAME

6       explain_iconv_close - explain iconv_close(3) errors
7

SYNOPSIS

9       #include <libexplain/iconv_close.h>
10       const char *explain_iconv_close(iconv_t cd);
11       const char *explain_errno_iconv_close(int errnum, iconv_t cd);
12       void explain_message_iconv_close(char *message, int message_size,
13       iconv_t cd);
14       void explain_message_errno_iconv_close(char *message, int message_size,
15       int errnum, iconv_t cd);
16

DESCRIPTION

18       These  functions may be used to obtain explanations for errors returned
19       by the iconv_close(3) system call.
20
21   explain_iconv_close
22       const char *explain_iconv_close(iconv_t cd);
23
24       The explain_iconv_close function is used to obtain an explanation of an
25       error returned by the iconv_close(3) system call. The least the message
26       will contain is the value of strerror(errno), but usually  it  will  do
27       much better, and indicate the underlying cause in more detail.
28
29       The  errno global variable will be used to obtain the error value to be
30       decoded.
31
32       cd      The original cd, exactly as passed to the iconv_close(3) system
33               call.
34
35       Returns:
36               The message explaining the error. This message buffer is shared
37               by all libexplain functions which do not  supply  a  buffer  in
38               their argument list.  This will be overwritten by the next call
39               to any libexplain function which shares this buffer,  including
40               other threads.
41
42       Note: This function is not thread safe, because it shares a return buf‐
43       fer across all threads, and many other functions in this library.
44
45       Example: This function is intended to be used in a fashion  similar  to
46       the following example:
47              errno = 0;
48              if (iconv_close(cd) < 0 && errno != 0)
49              {
50                  fprintf(stderr, "%s\n", explain_iconv_close(cd));
51                  exit(EXIT_FAILURE);
52              }
53
54       The   above   code   example   is   available   pre-packaged   as   the
55       explain_iconv_close_or_die(3) function.
56
57   explain_errno_iconv_close
58       const char *explain_errno_iconv_close(int errnum, iconv_t cd);
59
60       The explain_errno_iconv_close function is used to obtain an explanation
61       of  an error returned by the iconv_close(3) system call.  The least the
62       message will contain is the value of strerror(errno),  but  usually  it
63       will do much better, and indicate the underlying cause in more detail.
64
65       errnum  The  error value to be decoded, usually obtained from the errno
66               global variable just before this function is  called.  This  is
67               necessary  if you need to call any code between the system call
68               to be explained and this function, because many libc  functions
69               will alter the value of errno.
70
71       cd      The original cd, exactly as passed to the iconv_close(3) system
72               call.
73
74       Returns:
75               The message explaining the error. This message buffer is shared
76               by  all  libexplain  functions  which do not supply a buffer in
77               their argument list.  This will be overwritten by the next call
78               to  any libexplain function which shares this buffer, including
79               other threads.
80
81       Note: This function is not thread safe, because it shares a return buf‐
82       fer across all threads, and many other functions in this library.
83
84       Example:  This  function is intended to be used in a fashion similar to
85       the following example:
86              errno = 0;
87              if (iconv_close(cd) < 0 && errno != 0)
88              {
89                  int err = errno;
90                  fprintf(stderr, "%s\n", explain_errno_iconv_close(err, cd));
91                  exit(EXIT_FAILURE);
92              }
93
94       The   above   code   example   is   available   pre-packaged   as   the
95       explain_iconv_close_or_die(3) function.
96
97   explain_message_iconv_close
98       void explain_message_iconv_close(char *message, int message_size,
99       iconv_t cd);
100
101       The explain_message_iconv_close function is used to obtain an  explana‐
102       tion of an error returned by the iconv_close(3) system call.  The least
103       the message will contain is the value of strerror(errno),  but  usually
104       it  will  do  much  better,  and  indicate the underlying cause in more
105       detail.
106
107       The errno global variable will be used to obtain the error value to  be
108       decoded.
109
110       message The location in which to store the returned message. If a suit‐
111               able message return buffer is supplied, this function is thread
112               safe.
113
114       message_size
115               The  size  in  bytes  of  the  location  in  which to store the
116               returned message.
117
118       cd      The original cd, exactly as passed to the iconv_close(3) system
119               call.
120
121       Example:  This  function is intended to be used in a fashion similar to
122       the following example:
123              errno = 0;
124              if (iconv_close(cd) < 0 && errno != 0)
125              {
126                  char message[3000];
127                  explain_message_iconv_close(message, sizeof(message), cd);
128                  fprintf(stderr, "%s\n", message);
129                  exit(EXIT_FAILURE);
130              }
131
132       The   above   code   example   is   available   pre-packaged   as   the
133       explain_iconv_close_or_die(3) function.
134
135   explain_message_errno_iconv_close
136       void explain_message_errno_iconv_close(char *message, int message_size,
137       int errnum, iconv_t cd);
138
139       The explain_message_errno_iconv_close function is  used  to  obtain  an
140       explanation  of  an  error  returned by the iconv_close(3) system call.
141       The least the message will contain is the value of strerror(errno), but
142       usually  it  will  do much better, and indicate the underlying cause in
143       more detail.
144
145       message The location in which to store the returned message. If a suit‐
146               able message return buffer is supplied, this function is thread
147               safe.
148
149       message_size
150               The size in bytes  of  the  location  in  which  to  store  the
151               returned message.
152
153       errnum  The  error value to be decoded, usually obtained from the errno
154               global variable just before this function is  called.  This  is
155               necessary  if you need to call any code between the system call
156               to be explained and this function, because many libc  functions
157               will alter the value of errno.
158
159       cd      The original cd, exactly as passed to the iconv_close(3) system
160               call.
161
162       Example: This function is intended to be used in a fashion  similar  to
163       the following example:
164              errno = 0;
165              if (iconv_close(cd) < 0 && errno != 0)
166              {
167                  int err = errno;
168                  char message[3000];
169                  explain_message_errno_iconv_close(message, sizeof(message),
170                  err, cd);
171                  fprintf(stderr, "%s\n", message);
172                  exit(EXIT_FAILURE);
173              }
174
175       The   above   code   example   is   available   pre-packaged   as   the
176       explain_iconv_close_or_die(3) function.
177

SEE ALSO

179       iconv_close(3)
180               deallocate descriptor for character set conversion
181
182       explain_iconv_close_or_die(3)
183               deallocate  descriptor  for character set conversion and report
184               errors
185
187       libexplain version 1.4
188       Copyright (C) 2013 Peter Miller
189
190
191
192                                                        explain_iconv_close(3)
Impressum