1explain_setbuf_or_die(3) Library Functions Manual explain_setbuf_or_die(3)
2
3
4
6 explain_setbuf_or_die - set stream buffer and report errors
7
9 #include <libexplain/setbuf.h>
10 void explain_setbuf_or_die(FILE *fp, char *data);
11 void explain_setbuf_on_error(FILE *fp, char *data);
12
14 The explain_setbuf_or_die function is used to call the setbuf(3) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from the explain_setbuf(3) function, and then the process terminates by
17 calling exit(EXIT_FAILURE).
18
19 The explain_setbuf_on_error function is used to call the setbuf(3) sys‐
20 tem call. On failure an explanation will be printed to stderr, obtained
21 from the explain_setbuf(3) function, but still returns to the caller.
22
23 fp The fp, exactly as to be passed to the setbuf(3) system call.
24
25 data The data, exactly as to be passed to the setbuf(3) system call.
26
28 The explain_setbuf_or_die function only returns on success, see set‐
29 buf(3) for more information. On failure, prints an explanation and
30 exits, it does not return.
31
32 The explain_setbuf_on_error function always returns the value return by
33 the wrapped setbuf(3) system call.
34
36 The explain_setbuf_or_die function is intended to be used in a fashion
37 similar to the following example:
38 explain_setbuf_or_die(fp, data);
39
41 setbuf(3)
42 set stream buffer
43
44 explain_setbuf(3)
45 explain setbuf(3) errors
46
47 exit(2) terminate the calling process
48
50 libexplain version 1.4
51 Copyright (C) 2010 Peter Miller
52
53
54
55 explain_setbuf_or_die(3)