1explain_printf_or_die(3) Library Functions Manual explain_printf_or_die(3)
2
3
4
6 explain_printf_or_die - formatted output conversion and report errors
7
9 #include <libexplain/printf.h>
10 int explain_printf_or_die(const char *format);
11 int explain_printf_on_error(const char *format);
12
14 The explain_printf_or_die function is used to call the printf(3) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from the explain_printf(3) function, and then the process terminates by
17 calling exit(EXIT_FAILURE).
18
19 The explain_printf_on_error function is used to call the printf(3) sys‐
20 tem call. On failure an explanation will be printed to stderr, obtained
21 from the explain_printf(3) function, but still returns to the caller.
22
23 format The format, exactly as to be passed to the printf(3) system
24 call.
25
27 The explain_printf_or_die function only returns on success, see
28 printf(3) for more information. On failure, prints an explanation and
29 exits, it does not return.
30
31 The explain_printf_on_error function always returns the value return by
32 the wrapped printf(3) system call.
33
35 The explain_printf_or_die function is intended to be used in a fashion
36 similar to the following example:
37 int result = explain_printf_or_die(format);
38
40 printf(3)
41 formatted output conversion
42
43 explain_printf(3)
44 explain printf(3) errors
45
46 exit(2) terminate the calling process
47
49 libexplain version 0.40
50 Copyright (C) 2010 Peter Miller
51
52
53
54 explain_printf_or_die(3)