1explain_pclose_or_die(3) Library Functions Manual explain_pclose_or_die(3)
2
3
4
6 explain_pclose_or_die - process I/O and report errors
7
9 #include <libexplain/pclose.h>
10 int explain_pclose_or_die(FILE *fp);
11 int explain_pclose_success(FILE *fp);
12 void explain_pclose_success_or_die(FILE *fp);
13
15 These functions may be used to wait for program termination, and then
16 reprt errors returned by the pclose(3) system call.
17
18 explain_pclose_or_die
19 int explain_pclose_or_die(FILE *fp);
20
21 The explain_pclose_or_die function is used to call the pclose(3) system
22 call. On failure an explanation will be printed to stderr, obtained
23 from explain_pclose(3), and then the process terminates by calling
24 exit(EXIT_FAILURE).
25
26 This function is intended to be used in a fashion similar to the fol‐
27 lowing example:
28 int status = explain_pclose_or_die(fp);
29
30 fp The fp, exactly as to be passed to the pclose(3) system call.
31
32 Returns:
33 This function only returns on success, see pclose(3) for more
34 information. On failure, prints an explanation and exits.
35
36 explain_pclose_success_or_die
37 void explain_pclose_success_or_die(FILE *);
38
39 The explain_pclose_success_or_die function is used to call the
40 pclose(3) system call. On failure, including any exit status other
41 than EXIT_SUCCESS, an explanation will be printed to stderr, obtained
42 from explain_pclose(3), and then the process terminates by calling
43 exit(EXIT_FAILURE).
44
45 This function is intended to be used in a fashion similar to the fol‐
46 lowing example:
47 explain_pclose_success_or_die(fp);
48
49 fp The fp, exactly as to be passed to the pclose(3) system call.
50
51 Returns:
52 This function only returns on success. On failure, prints an
53 explanation and exits.
54
55 explain_pclose_success
56 int explain_pclose_success(FILE *fp);
57
58 The explain_pclose_success function is used to call the pclose(3) sys‐
59 tem call. On failure, including any exit status other than EXIT_SUC‐
60 CESS, an explanation will be printed to stderr, obtained from
61 explain_pclose(3). However, the priniting of an error message does not
62 also cause exit(2) to be called.
63
64 This function is intended to be used in a fashion similar to the fol‐
65 lowing example:
66 int status = explain_pclose_success(command);
67
68 fp The fp, exactly as to be passed to the pclose(3) system call.
69
70 Returns:
71 the value returned by the pclose(3) system call. In all cases
72 other than EXIT_SUCCESS, an error message will also have been
73 printed to stderr.
74
76 pclose(3)
77 process I/O
78
79 explain_pclose(3)
80 explain pclose(3) errors
81
82 exit(2) terminate the calling process
83
85 libexplain version 1.4
86 Copyright (C) 2009 Peter Miller
87
88
89
90 explain_pclose_or_die(3)