]>
Commit | Line | Data |
---|---|---|
392d7920 | 1 | /* Routines for dealing with '\0' separated environment vectors |
b168057a | 2 | Copyright (C) 1995-2015 Free Software Foundation, Inc. |
41bdb6e2 | 3 | This file is part of the GNU C Library. |
392d7920 | 4 | |
54d79e99 | 5 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
392d7920 | 9 | |
54d79e99 UD |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
392d7920 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
41bdb6e2 | 13 | Lesser General Public License for more details. |
392d7920 | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
392d7920 | 18 | |
5107cf1d UD |
19 | #ifndef _ENVZ_H |
20 | #define _ENVZ_H 1 | |
23396375 | 21 | |
23396375 | 22 | #include <features.h> |
392d7920 RM |
23 | |
24 | #include <errno.h> | |
25 | ||
26 | /* Envz's are argz's too, and should be created etc., using the same | |
27 | routines. */ | |
28 | #include <argz.h> | |
29 | ||
54d79e99 UD |
30 | __BEGIN_DECLS |
31 | ||
392d7920 | 32 | /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none. */ |
a784e502 UD |
33 | extern char *envz_entry (const char *__restrict __envz, size_t __envz_len, |
34 | const char *__restrict __name) | |
e656498e | 35 | __THROW __attribute_pure__; |
392d7920 RM |
36 | |
37 | /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0 | |
38 | if there is none. */ | |
a784e502 UD |
39 | extern char *envz_get (const char *__restrict __envz, size_t __envz_len, |
40 | const char *__restrict __name) | |
e656498e | 41 | __THROW __attribute_pure__; |
392d7920 RM |
42 | |
43 | /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN. If an entry | |
44 | with the same name already exists in ENVZ, it is removed. If VALUE is | |
45 | NULL, then the new entry will a special null one, for which envz_get will | |
46 | return NULL, although envz_entry will still return an entry; this is handy | |
47 | because when merging with another envz, the null entry can override an | |
48 | entry in the other one. Null entries can be removed with envz_strip (). */ | |
c1422e5b UD |
49 | extern error_t envz_add (char **__restrict __envz, |
50 | size_t *__restrict __envz_len, | |
a784e502 UD |
51 | const char *__restrict __name, |
52 | const char *__restrict __value) __THROW; | |
392d7920 RM |
53 | |
54 | /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If | |
6d52618b | 55 | OVERRIDE is true, then values in ENVZ2 will supersede those with the same |
392d7920 | 56 | name in ENV, otherwise not. */ |
c1422e5b UD |
57 | extern error_t envz_merge (char **__restrict __envz, |
58 | size_t *__restrict __envz_len, | |
a784e502 | 59 | const char *__restrict __envz2, |
c1422e5b | 60 | size_t __envz2_len, int __override) __THROW; |
392d7920 | 61 | |
ee586e0e | 62 | /* Remove the entry for NAME from ENVZ & ENVZ_LEN, if any. */ |
c1422e5b UD |
63 | extern void envz_remove (char **__restrict __envz, |
64 | size_t *__restrict __envz_len, | |
a784e502 | 65 | const char *__restrict __name) __THROW; |
ee586e0e | 66 | |
392d7920 | 67 | /* Remove null entries. */ |
c1422e5b UD |
68 | extern void envz_strip (char **__restrict __envz, |
69 | size_t *__restrict __envz_len) __THROW; | |
392d7920 | 70 | |
54d79e99 UD |
71 | __END_DECLS |
72 | ||
5107cf1d | 73 | #endif /* envz.h */ |