Update.
[glibc.git] / string / envz.h
blob293166ba245809220939230eeed60f2589d04d96
1 /* Routines for dealing with '\0' separated environment vectors
2 Copyright (C) 1995, 96, 98, 99, 2000 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _ENVZ_H
20 #define _ENVZ_H 1
22 #include <features.h>
24 #include <errno.h>
26 /* Envz's are argz's too, and should be created etc., using the same
27 routines. */
28 #include <argz.h>
30 __BEGIN_DECLS
32 /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none. */
33 extern char *envz_entry (__const char *__restrict __envz, size_t __envz_len,
34 __const char *__restrict __name)
35 __THROW __attribute_pure__;
37 /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0
38 if there is none. */
39 extern char *envz_get (__const char *__restrict __envz, size_t __envz_len,
40 __const char *__restrict __name)
41 __THROW __attribute_pure__;
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 (). */
49 extern error_t envz_add (char **__restrict __envz,
50 size_t *__restrict __envz_len,
51 __const char *__restrict __name,
52 __const char *__restrict __value) __THROW;
54 /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If
55 OVERRIDE is true, then values in ENVZ2 will supersede those with the same
56 name in ENV, otherwise not. */
57 extern error_t envz_merge (char **__restrict __envz,
58 size_t *__restrict __envz_len,
59 __const char *__restrict __envz2,
60 size_t __envz2_len, int __override) __THROW;
62 /* Remove the entry for NAME from ENVZ & ENVZ_LEN, if any. */
63 extern void envz_remove (char **__restrict __envz,
64 size_t *__restrict __envz_len,
65 __const char *__restrict __name) __THROW;
67 /* Remove null entries. */
68 extern void envz_strip (char **__restrict __envz,
69 size_t *__restrict __envz_len) __THROW;
71 __END_DECLS
73 #endif /* envz.h */