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

NAME

6       explain_strtoull - explain strtoull(3) errors
7

SYNOPSIS

9       #include <libexplain/strtoull.h>
10       const char *explain_strtoull(const char *nptr, char **endptr, int
11       base);
12       const char *explain_errno_strtoull(int errnum, const char *nptr, char
13       **endptr, int base);
14       void explain_message_strtoull(char *message, int message_size, const
15       char *nptr, char **endptr, int base);
16       void explain_message_errno_strtoull(char *message, int message_size,
17       int errnum, const char *nptr, char **endptr, int base);
18

DESCRIPTION

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

SEE ALSO

209       strtoull(3)
210               convert a string to an unsigned long integer
211
212       explain_strtoull_or_die(3)
213               convert a string to an unsigned long integer and report errors
214
216       libexplain version 0.40
217       Copyright (C) 2009 Peter Miller
218
219
220
221                                                           explain_strtoull(3)
Impressum