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