1explain_asprintf_or_die(3) Library Functions Manual explain_asprintf_or_die(3)
2
3
4
6 explain_asprintf_or_die - print to allocated string and report errors
7
9 #include <libexplain/asprintf.h>
10 int explain_asprintf_or_die(, ...);
11 int explain_asprintf_on_error(, ...);
12
14 The explain_asprintf_or_die function is used to call the asprintf(3)
15 system call. On failure an explanation will be printed to stderr,
16 obtained from the explain_asprintf(3) function, and then the process
17 terminates by calling exit(EXIT_FAILURE).
18
19 The explain_asprintf_on_error function is used to call the asprintf(3)
20 system call. On failure an explanation will be printed to stderr,
21 obtained from the explain_asprintf(3) function, but still returns to
22 the caller.
23
25 The explain_asprintf_or_die function only returns on success, see
26 asprintf(3) for more information. On failure, prints an explanation and
27 exits, it does not return.
28
29 The explain_asprintf_on_error function always returns the value return
30 by the wrapped asprintf(3) system call.
31
33 The explain_asprintf_or_die function is intended to be used in a fash‐
34 ion similar to the following example:
35 int result = explain_asprintf_or_die();
36
38 asprintf(3)
39 print to allocated string
40
41 explain_asprintf(3)
42 explain asprintf(3) errors
43
44 exit(2) terminate the calling process
45
47 libexplain version 1.4
48 Copyright (C) 2013 Peter Miller
49
50
51
52 explain_asprintf_or_die(3)