1explain_vasprintf_or_die(3)Library Functions Manualexplain_vasprintf_or_die(3)
2
3
4
6 explain_vasprintf_or_die - print to allocated string and report errors
7
9 #include <libexplain/vasprintf.h>
10 int explain_vasprintf_or_die(char **data, const char *format, va_list
11 ap);
12 int explain_vasprintf_on_error(char **data, const char *format, va_list
13 ap);
14
16 The explain_vasprintf_or_die function is used to call the vasprintf(3)
17 system call. On failure an explanation will be printed to stderr,
18 obtained from the explain_vasprintf(3) function, and then the process
19 terminates by calling exit(EXIT_FAILURE).
20
21 The explain_vasprintf_on_error function is used to call the
22 vasprintf(3) system call. On failure an explanation will be printed to
23 stderr, obtained from the explain_vasprintf(3) function, but still
24 returns to the caller.
25
26 data The data, exactly as to be passed to the vasprintf(3) system
27 call.
28
29 format The format, exactly as to be passed to the vasprintf(3) system
30 call.
31
32 ap The ap, exactly as to be passed to the vasprintf(3) system
33 call.
34
36 The explain_vasprintf_or_die function only returns on success, see
37 vasprintf(3) for more information. On failure, prints an explanation
38 and exits, it does not return.
39
40 The explain_vasprintf_on_error function always returns the value return
41 by the wrapped vasprintf(3) system call.
42
44 The explain_vasprintf_or_die function is intended to be used in a fash‐
45 ion similar to the following example:
46 int result = explain_vasprintf_or_die(data, format, ap);
47
49 vasprintf(3)
50 print to allocated string
51
52 explain_vasprintf(3)
53 explain vasprintf(3) errors
54
55 exit(2) terminate the calling process
56
58 libexplain version 1.4
59 Copyright (C) 2013 Peter Miller
60
61
62
63 explain_vasprintf_or_die(3)