Few last minute patches from main on 960811
[glibc/history.git] / string / envz.h
blobdfd5e8aeb661dd9ebd2e47ee7eff9b12a389a161
1 /* Routines for dealing with '\0' separated environment vectors
2 Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3 Written by Miles Bader <miles@gnu.ai.mit.edu>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2, or (at
8 your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19 #ifndef __ENVZ_H__
21 #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 /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none. */
31 extern char *envz_entry __P ((__const char *__envz, size_t __envz_len,
32 __const char *__name));
34 /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0
35 if there is none. */
36 extern char *envz_get __P ((__const char *__envz, size_t __envz_len,
37 __const char *__name));
39 /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN. If an entry
40 with the same name already exists in ENVZ, it is removed. If VALUE is
41 NULL, then the new entry will a special null one, for which envz_get will
42 return NULL, although envz_entry will still return an entry; this is handy
43 because when merging with another envz, the null entry can override an
44 entry in the other one. Null entries can be removed with envz_strip (). */
45 extern error_t envz_add __P ((char **__envz, size_t *__envz_len,
46 __const char *__name, __const char *__value));
48 /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If
49 OVERRIDE is true, then values in ENVZ2 will supercede those with the same
50 name in ENV, otherwise not. */
51 extern error_t envz_merge __P ((char **__envz, size_t *__envz_len,
52 __const char *__envz2, size_t __envz2_len,
53 int __override));
55 /* Remove null entries. */
56 extern void envz_strip __P ((char **__envz, size_t *__envz_len));
58 #endif /* __ENVZ_H__ */