/src/util-linux/include/env.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * No copyright is claimed. This code is in the public domain; do with |
3 | | * it what you wish. |
4 | | */ |
5 | | #ifndef UTIL_LINUX_ENV_H |
6 | | #define UTIL_LINUX_ENV_H |
7 | | |
8 | | #include "c.h" |
9 | | #include "nls.h" |
10 | | |
11 | | struct ul_env_list; |
12 | | |
13 | | extern void sanitize_env(void); |
14 | | extern void __sanitize_env(struct ul_env_list **org); |
15 | | |
16 | | extern struct ul_env_list *env_list_add_variable(struct ul_env_list *ls, |
17 | | const char *name, const char *value); |
18 | | |
19 | | extern struct ul_env_list *env_list_add_getenv(struct ul_env_list *ls, |
20 | | const char *name, const char *dflt); |
21 | | extern struct ul_env_list *env_list_add_getenvs(struct ul_env_list *ls, |
22 | | const char *str); |
23 | | |
24 | | extern int env_list_setenv(struct ul_env_list *ls, int overwrite); |
25 | | extern void env_list_free(struct ul_env_list *ls); |
26 | | extern struct ul_env_list *env_list_from_fd(int pid); |
27 | | |
28 | | extern char *safe_getenv(const char *arg); |
29 | | |
30 | | #ifndef XSETENV_EXIT_CODE |
31 | | # define XSETENV_EXIT_CODE EXIT_FAILURE |
32 | | #endif |
33 | | |
34 | | static inline void xsetenv(char const *name, char const *val, int overwrite) |
35 | 0 | { |
36 | 0 | if (setenv(name, val, overwrite) != 0) |
37 | 0 | err(XSETENV_EXIT_CODE, _("failed to set the %s environment variable"), name); |
38 | 0 | } Unexecuted instantiation: cache.c:xsetenv Unexecuted instantiation: config.c:xsetenv Unexecuted instantiation: env.c:xsetenv |
39 | | |
40 | | static inline int ul_remove_entry(char **argv, int remove, int last) |
41 | 0 | { |
42 | 0 | memmove(argv + remove, argv + remove + 1, sizeof(char *) * (last - remove)); |
43 | 0 | return last - 1; |
44 | 0 | } Unexecuted instantiation: cache.c:ul_remove_entry Unexecuted instantiation: config.c:ul_remove_entry Unexecuted instantiation: env.c:ul_remove_entry |
45 | | |
46 | | #endif /* UTIL_LINUX_ENV_H */ |