1explain_strtoul_or_die(3) Library Functions Manual explain_strtoul_or_die(3)
2
3
4
6 explain_strtoul_or_die - convert string to unsigned long and report
7 errors
8
10 #include <libexplain/strtoul.h>
11 unsigned long explain_strtoul_or_die(const char *nptr, char **endptr,
12 int base);
13 unsigned long explain_strtoul_on_error(const char *nptr, char **endptr,
14 int base))
15
17 The explain_strtoul_or_die function is used to call the strtoul(3) sys‐
18 tem call. On failure an explanation will be printed to stderr, obtained
19 from the explain_strtoul(3) function, and then the process terminates
20 by calling exit(EXIT_FAILURE).
21
22 The explain_strtoul_on_error function is used to call the strtoul(3)
23 system call. On failure an explanation will be printed to stderr,
24 obtained from the explain_strtoul(3) function, but still returns to the
25 caller.
26
27 nptr The nptr, exactly as to be passed to the strtoul(3) system
28 call.
29
30 endptr The endptr, exactly as to be passed to the strtoul(3) system
31 call.
32
33 base The base, exactly as to be passed to the strtoul(3) system
34 call.
35
37 The explain_strtoul_or_die function only returns on success, see str‐
38 toul(3) for more information. On failure, prints an explanation and
39 exits, it does not return.
40
41 The explain_strtoul_on_error function always returns the value return
42 by the wrapped strtoul(3) system call.
43
45 The explain_strtoul_or_die function is intended to be used in a fashion
46 similar to the following example:
47 unsigned long result = explain_strtoul_or_die(nptr, endptr, base);
48
50 strtoul(3)
51 convert a string to an unsigned long integer
52
53 explain_strtoul(3)
54 explain strtoul(3) errors
55
56 exit(2) terminate the calling process
57
59 libexplain version 0.40
60 Copyright (C) 2009 Peter Miller
61
62
63
64 explain_strtoul_or_die(3)