2.9
[glibc/nacl-glibc.git] / string / envz.h
blob3542ded721f5aa23f61b8645d696caebaa02f38f
1 /* Routines for dealing with '\0' separated environment vectors
2 Copyright (C) 1995, 96, 98, 99, 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
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.
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
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _ENVZ_H
21 #define _ENVZ_H 1
23 #include <features.h>
25 #include <errno.h>
27 /* Envz's are argz's too, and should be created etc., using the same
28 routines. */
29 #include <argz.h>
31 __BEGIN_DECLS
33 /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none. */
34 extern char *envz_entry (__const char *__restrict __envz, size_t __envz_len,
35 __const char *__restrict __name)
36 __THROW __attribute_pure__;
38 /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0
39 if there is none. */
40 extern char *envz_get (__const char *__restrict __envz, size_t __envz_len,
41 __const char *__restrict __name)
42 __THROW __attribute_pure__;
44 /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN. If an entry
45 with the same name already exists in ENVZ, it is removed. If VALUE is
46 NULL, then the new entry will a special null one, for which envz_get will
47 return NULL, although envz_entry will still return an entry; this is handy
48 because when merging with another envz, the null entry can override an
49 entry in the other one. Null entries can be removed with envz_strip (). */
50 extern error_t envz_add (char **__restrict __envz,
51 size_t *__restrict __envz_len,
52 __const char *__restrict __name,
53 __const char *__restrict __value) __THROW;
55 /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If
56 OVERRIDE is true, then values in ENVZ2 will supersede those with the same
57 name in ENV, otherwise not. */
58 extern error_t envz_merge (char **__restrict __envz,
59 size_t *__restrict __envz_len,
60 __const char *__restrict __envz2,
61 size_t __envz2_len, int __override) __THROW;
63 /* Remove the entry for NAME from ENVZ & ENVZ_LEN, if any. */
64 extern void envz_remove (char **__restrict __envz,
65 size_t *__restrict __envz_len,
66 __const char *__restrict __name) __THROW;
68 /* Remove null entries. */
69 extern void envz_strip (char **__restrict __envz,
70 size_t *__restrict __envz_len) __THROW;
72 __END_DECLS
74 #endif /* envz.h */