1explain_setenv_or_die(3) Library Functions Manual explain_setenv_or_die(3)
2
3
4
6 explain_setenv_or_die - change or add an environment variable and
7 report errors
8
10 #include <libexplain/setenv.h>
11 void explain_setenv_or_die(const char *name, const char *value, int
12 overwrite);
13 int explain_setenv_on_error(const char *name, const char *value, int
14 overwrite);
15
17 The explain_setenv_or_die function is used to call the setenv(3) system
18 call. On failure an explanation will be printed to stderr, obtained
19 from the explain_setenv(3) function, and then the process terminates by
20 calling exit(EXIT_FAILURE).
21
22 The explain_setenv_on_error function is used to call the setenv(3) sys‐
23 tem call. On failure an explanation will be printed to stderr, obtained
24 from the explain_setenv(3) function, but still returns to the caller.
25
26 name The name, exactly as to be passed to the setenv(3) system call.
27
28 value The value, exactly as to be passed to the setenv(3) system
29 call.
30
31 overwrite
32 The overwrite, exactly as to be passed to the setenv(3) system
33 call.
34
36 The explain_setenv_or_die function only returns on success, see
37 setenv(3) for more information. On failure, prints an explanation and
38 exits, it does not return.
39
40 The explain_setenv_on_error function always returns the value return by
41 the wrapped setenv(3) system call.
42
44 The explain_setenv_or_die function is intended to be used in a fashion
45 similar to the following example:
46 explain_setenv_or_die(name, value, overwrite);
47
49 setenv(3)
50 change or add an environment variable
51
52 explain_setenv(3)
53 explain setenv(3) errors
54
55 exit(2) terminate the calling process
56
58 libexplain version 0.40
59 Copyright (C) 2010 Peter Miller
60
61
62
63 explain_setenv_or_die(3)